Managing Node.JS and IO.JS with NVM

Managing Node.JS and IO.JS with NVM

Are you building NodeJS Aps? Use NVM!

If you haven't seen NVM in action, go and install it now. I can't imagine working with Node.JS based projects without NVM. I wrote this short post, beacuse I saw a friend of mine doing some first steps in NodeJS without having NVM installed. And instead of explaining the basics on the phone I wrote a short summary, which I'd like to share with you.

Working on multiple JavaScript based projects can be cumbersome. In the past developers had to manage different Node.JS versions locally and switch them for each and every project they're involved.

Since the beginning of 2015, IO.js may also be part of many JavaScript developer's toolbelt. So managing all those frameworks is - again - a little bit more effort.

I've been using RVM in the past to deal with the different Ruby installations on my machines. What RVM offers for Ruby, is NVM for the JavaScript developer. I'm using NVM for more than a year now and it's a big time-safer for me.

Besides managing the local NodeJS installations, it also offers me the ability to easily test any app for platform upgrades. A few weeks ago I started a new NodeJS based project which I'm currently developing besides my regular work. NVM allows me to switch the current node version easily by executing

nvm use stable or nvm use v0.12.0

Use nvm ls to see which versions are installed locally, when executing nvm ls-remote you'll see a list of all available NodeJS and ioJS versions. Installing a new version is really simple.Just execute nvm install iojs-v1.3.0 to install the most recent ioJS version on your system. Installing ioJS using NVM does not change something - for the first view.

In order to switch from NodeJS to ioJS you've to execute nvm use iojs-v1.3.0. From this point, all your Node calls will be forwarded to the local installtion of ioJS v1.3.0.

You can see which framework you're currently running by executing

nvm current

In order to uninstall a version from your system, just type nvm uninstall iojs-v1.3.0

As you can see, it's pretty simple to get started with NVM. The biggest advantage in my eyes is that you don't loose the flexibility of changing the node engine once your environment has been setted up. And as mentioned during the introduction you can switch versions based on your projects in no time.


comments powered by Disqus