<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Dan Harris</title>
    <description>The latest articles on DEV Community by Dan Harris (@danharris_io).</description>
    <link>https://dev.to/danharris_io</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F114477%2F8307b36a-7380-4594-b4e7-7f63671d3815.jpg</url>
      <title>DEV Community: Dan Harris</title>
      <link>https://dev.to/danharris_io</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/danharris_io"/>
    <language>en</language>
    <item>
      <title>Setting up your Node environment using nvm for windows</title>
      <dc:creator>Dan Harris</dc:creator>
      <pubDate>Tue, 12 Mar 2019 22:19:38 +0000</pubDate>
      <link>https://dev.to/danharris_io/setting-up-your-node-environment-using-nvm-forwindows-2601</link>
      <guid>https://dev.to/danharris_io/setting-up-your-node-environment-using-nvm-forwindows-2601</guid>
      <description>&lt;h2&gt;
  
  
  Never be off by a node version again 😲…. setup node version manager for Windows.
&lt;/h2&gt;

&lt;p&gt;One of the great things about where I work is our commitment to giving juniors a go (for our sister social enterprise, &lt;a href="https://twitter.com/teamHFoH"&gt;Head Full of Heart&lt;/a&gt;, its actually the core mission 👍).&lt;br&gt;
As most of our code repo's incorporate some kind of node build or run, a question that is commonly asked is how to setup your environment to actually run node.&lt;/p&gt;

&lt;p&gt;Well... have no fear 😱, that's where this &lt;em&gt;short&lt;/em&gt; article comes in. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;* Just a reminder, this article shows the setup in windows... but setup in Mac or Linux is pretty similar 👍.&lt;/em&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  🤷‍♀️ why bother managing node versions?
&lt;/h3&gt;

&lt;p&gt;Well I'm glad you asked! When working on a project (especially within a team), its ideal to have as similar an environment as possible to both your peers, but more importantly, your build server. &lt;br&gt;
Strange issues 👻 can arise when using mismatched versions of node (and by extension npm)... e.g. dependencies failing to build, hard to debug runtime errors .etc.&lt;/p&gt;

&lt;p&gt;So... when you're working across a single project at any time, that's fairly easy. You simply install a matching version of node &amp;amp; off you go. The trick comes when you need to jump across multiple projects (which may have multiple node requirements). &lt;/p&gt;

&lt;p&gt;By managing our node version, we're able to quickly switch our global node context. Hazah! Problems gone 🦸‍♀️.&lt;/p&gt;




&lt;h3&gt;
  
  
  ⏳ install nvm-for-windows
&lt;/h3&gt;

&lt;p&gt;To manage our node version and flip between various node versions, we're going to use an awesome tool called &lt;a href="https://github.com/coreybutler/nvm-windows"&gt;nvm-for-windows&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Installing nvm-for-windows is as simple as heading on over to &lt;br&gt;
&lt;a href="https://github.com/coreybutler/nvm-windows/releases"&gt;github.com/coreybutler/nvm-windows/releases&lt;/a&gt; and downloading the latest release 👉 &lt;code&gt;nvm-setup.zip&lt;/code&gt;. The setup zip bundle will include an installer... and away you go.&lt;/p&gt;

&lt;p&gt;A couple of recommendations when running through the installer;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;install &lt;em&gt;nvm-for-windows&lt;/em&gt; into a directory other than the default (e.g. &lt;code&gt;c:\my-workspace\apps\nvm&lt;/code&gt;). This will fix a couple of strange issues that sometimes occur with spaces in the directory path (&lt;code&gt;Program Files\nvm&lt;/code&gt;). It also allows you to segregate your global node installs and any other node_modules.&lt;/li&gt;
&lt;li&gt;after installing, sometimes you may have to restart your computer for the path variables to be picked up (e.g. if you get the error &lt;code&gt;'nvm' is not recognized as an internal or external command&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After installing, you should be able to use the &lt;code&gt;nvm&lt;/code&gt; command on the commandline. Next up, let's set a node version to use.&lt;/p&gt;




&lt;h3&gt;
  
  
  ⚡ use a node version
&lt;/h3&gt;

&lt;p&gt;Setting our node version is now as simple as installing the right version using nvm 👉 &lt;code&gt;nvm install 8.9&lt;/code&gt;. We then need to 'use' that version (which is how we change node versions using nvm - unless you've got a slicker setup using a &lt;code&gt;.nvmrc&lt;/code&gt; or similar)... 👉 &lt;code&gt;nvm use 8.9&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;* I'd run the above commands - or at least the install command - using an elevated commandline, sometime odd things happen 🤷‍♂️.&lt;/em&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  🤔 well that wasn't hard?
&lt;/h3&gt;

&lt;p&gt;Hopefully the above was pretty easy... but sometimes odd things occur. Let me know in the comments if you get a strange error or some other heeby-jeeby.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;* As always - constructive feedback, opinions, improvements and comments are all welcome. Comment here, or hit me up on twitter &lt;a class="comment-mentioned-user" href="https://dev.to/danharris_io"&gt;@danharris_io&lt;/a&gt;
 . Thanks for reading!&lt;/em&gt;&lt;br&gt;
&lt;em&gt;* original (unedited) title icon courtesy of Freepik from flaticon.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>nvm</category>
      <category>windows</category>
      <category>node</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
