Node.js in 3 commands

how-to
Mar 12, 20132 mins

A few short years ago when I started to explore Node.js, I remember the installation on my MacBook Pro required downloading the source, compiling and installing it, and then updating paths. And then you had to install NPM.

Since then, Node’s installation has been come tremendously easy and NPM is even bundled with Node. And yet, installing Node (and keeping up w/its rapid release schedule) is even easier with a nifty tool: Node Version Manager.

With Node Version Manager (or nvm) you can be up and running with Node in 3 easy commands.

Step 1: Download and install nvm.

downloading nvm
<span class='line-number'>1</span>
<code class='bash'><span class='line'>curl <a href="https://raw.github.com/creationix/nvm/master/install.sh">https://raw.github.com/creationix/nvm/master/install.sh</a> | sh
</span>

Step 2: Reload your shell.

reloading .bash_profile
<span class='line-number'>1</span>
<code class='bash'><span class='line'><span class="nb">source</span> .bash_profile
</span>

Step 2.5: Obtain a list of available node versions to install.

listing available node versions
<span class='line-number'>1</span>
<code class='bash'><span class='line'>nvm ls-remote
</span>

Step 3: Install your desired version of node.

installing node version 0.10.0
<span class='line-number'>1</span>
<code class='bash'><span class='line'>nvm install v0.10.0
</span>

After that’s done, execute a node -v to verify. Now wasn’t that easy? You bet!

andrew_glover

When Andrew Glover isn't listening to “Funkytown” or “Le Freak” he enjoys speaking on the No Fluff Just Stuff Tour. He also writes articles for multiple online publications including IBM's developerWorks and O'Reilly’s ONJava and ONLamp portals. Andrew is also the co-author of Java Testing Patterns, which was published by Wiley in September 2004; Addison-Wesley’s Continuous Integration; and Manning’s Groovy in Action.

More from this author