Managing Multiple Node.js Versions With NVM

1 minute read

If you are coming from a Ruby background or at least have some experience with it. The possibility that you are already familiar with multiple version management is pretty high (yes, talking about RVM).

Since Node.js is in very active development and getting releases pretty fast sometimes you may want to check if the version update breaks your dependencies or your application. But without having a version management tool for your Node.js installation it's pretty messy to upgrade and the vice versa. To avoid this and manage multiple different versions of Node.js installations NVM ( Node Version Manager) comes very handy.

Installation

Installing NVM is pretty simple ( assuming that you are on a POSIX system like OS X / Linux ) . Also you need a working C++ compiler.

 curl https://raw.github.com/creationix/nvm/master/install.sh | sh

There you go now NVM is installed in your ~/.nvm folder. If you are using Bash shell the NVM command will be available upon restarting your Terminal.
But if you are using a different shell like Zsh or so be sure to insert the NVM path to your ./.zprofile file.

Usage

The usage is also pretty simple.

For example if you want to download,compile and install v0.11.3.

nvm install 0.11.3

To use the newly installed version.

nvm use 0.11.3

To see your current Node installations.

nvm ls

To see the available Node installations.

nvm ls-remote

And to make a version the default in your system.

nvm alias default 0.11.3

Leave a Comment