NVM: Node Version Manager


The Node Version Manager allows admins to easily manage node.js versions. It’s a bash script that has the capability to manage multiple active versions of node.js, with functionality such as: installation, executing commands with specific node.js versions, setting the PATH variable to use a specific node.js versions, etc.

Installing NVM on Ubuntu


apt-get update
apt-get install build-essential libssl-dev


curl https://raw.githubusercontent.com/creationix/nvm/v0.30.2/install.sh | bash
#Close and reopen your terminal to start using nvm
source ~/.profile

Step3:- verify installation

nvm --version

To download, compile, and install the latest release of node

nvm install node

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

nvm use node

Or you can just run it:

nvm run node --version

Or, you can run any arbitrary command in a subshell with the desired version of node:

nvm exec 4.2 node --version

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

nvm which 5.0

If you want to use the system-installed version of node, you can use the special default alias “system”:

nvm use system
nvm run system --version

Listing versions
If you want to see what versions are installed:

nvm ls

If you want to see what versions are available to install:

nvm ls-remote

To restore your PATH, you can deactivate it:

nvm deactivate

To set a default Node version to be used in any new shell, use the alias ‘default’:

nvm alias default node

You can create a .nvmrc file containing version number in the project root directory (or any parent directory). nvm use, nvm install, nvm exec, nvm run, and nvm which will all respect an .nvmrc file when a version is not supplied.

Leave a Reply

Your email address will not be published. Required fields are marked *