Improve this doc
nvm is a Node Version Manager that allows you to manage multiple active node.js installations with different versions.
nvm you can install several node versions at the same time and switch between them as you wish. Global packages are installed per node, so you can e.g. have different Ionic CLI versions installed for different node versions.
macOS and Linux
To install or update nvm, you can use the install script using cURL:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash
The script clones the nvm repository to
~/.nvm and adds the source line to your profile (
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
You can customize the install source, directory, profile, and version using the
curl ... | NVM_DIR=/usr/local/nvm bash for a global install.
NB. The installer can use
wget to download
nvm, whatever is available.
Note: On OS X, if you get
nvm: command not found after running the install script, one of the following might be the reason:-
- your system may not have a [
.bash_profile file] where the command is set up. Simply create one with
touch ~/.bash_profile and run the install script again
- you might need to restart your terminal instance. Try opening a new tab/window in your terminal and retry.
If the above doesn’t fix the problem, open your
.bash_profile and add the following line of code:
- For more information about this issue and possible workarounds, please refer here
To verify that nvm has been installed, do:
which should output ‘nvm’ if the installation was successful.
To download, compile, and install the latest release of node, do this:
And then in any new shell just use the installed version:
Or you can just run it:
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:
In place of a version pointer like “0.10” or “5.0” or “4.2.1”, you can use the following special default aliases with
nvm which, etc:
node: this installs the latest version of
iojs: this installs the latest version of
stable: this alias is deprecated, and only truly applies to
v0.12 and earlier. Currently, this is an alias for
unstable: this alias points to
v0.11 - the last “unstable” node release, since post-1.0, all node versions are stable. (in semver, versions communicate breakage, not stability).
To install NVM on windows, visit the nvm-windows repo and download the latest installer
To list the available and installable node versions:
To install the selected node version call:
See how it installed and which node versions can be used:
To activate a node installation, do:
And if a node version is not required any more, execute: