Install and Manage Node Versions with NVM

It’s very easy to install and manage multiple active node.js versions by Node Version Manager(NVM).

Install or update nvm

First you’ll need to make sure your system has a c++ compiler. For OSX, XCode will work. And then install or update nvm by the following command:

1
2
3
# The script clones the nvm repository to ~/.nvm and adds the source line to your profile (~/.bash_profile, ~/.zshrc or ~/.profile).
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash

Manage node versions

To download, compile, and install the latest v5.7.x release of node, do this:

1
$ nvm install 5.7

And then in any new shell just use the installed version:

1
$ nvm use 5.7

You can also get the path to the executable to where it was installed:

1
$ nvm which 5.7

You can see what versions are installed:

1
$ nvm ls
Contents
  1. 1. Install or update nvm
  2. 2. Manage node versions
|