Are you building Node.js Apps? Use NVM!
If you haven’t seen NVM (Node Version Manager) in action, go and install it now. I can’t imagine working with Node.js based projects without NVM. I wrote this short post because I saw a friend of mine doing some first steps in Node.js without having NVM installed. So instead of explaining him the basics on a phone call, I wrote this summary, which I’d like to share with you.
Besides managing the local NodeJS installations, it also offers me the ability to quickly 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
nvm ls to see which versions are installed locally, when executing
nvm ls-remote you’ll see a list of all available Node.js and io.js versions. Installing a new version is simple. Just execute
nvm install iojs-v1.3.0 to install the most recent ioJS version on your system. Installing io.js using NVM does not change something – for the first view.
To switch from Node.js to io.hs you’ve to execute
nvm use iojs-v1.3.0. From this point, all your Node calls will be forwarded to the local installation of io.js v1.3.0.
You can see which framework you’re currently running by executing.
To uninstall a version from your system, type
nvm uninstall iojs-v1.3.0
As you can see, it’s pretty simple to get started with NVM. The most significant advantage in my eyes is that you don’t lose the flexibility of changing the node engine once your environment has been set up. As mentioned during the introduction you can switch versions based on your projects in no time.