Terry : Node Version Manager

Node Version Manager

What is Node Version Manager?

NVM is a version manager for node.js, similar to RVM and rbenv for Ruby.


Make sure the system has a c++ compiler. For OSX, XCode will work, for Ubuntu, the build-essential and libssl-dev packages work.

Install script

To install you could use the install script (requires Git) using cURL

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

or Wget

wget --no-check-certificate -qO- https://raw.github.com/creationix/nvm/master/install.sh | sh

The script clones the Nvm repository to ~/.nvm and adds the source line to your profile (~/.bash_profile or ~/.profile).

Manual install

For manual install create a folder somewhere in your filesystem with the nvm.sh file inside it. I put mine in a folder called nvm

git clone https://github.com/creationix/nvm.git ~/nvm

To activate nvm, source it from bash shell

. ~/nvm/nvm.sh
# or source it
source ~/nvm/nvm.sh

Add it to ~/.bash_profile or ~/.profile file (for interactive & non-interactive login shells) to have it automatically sourced upon login.

wget example using the install script

$ wget --no-check-certificate -qO- https://raw.github.com/creationix/nvm/master/install.sh | sh
Cloning into '/home/ubuntu/.nvm'...
remote: Counting objects: 557, done.
remote: Compressing objects: 100% (328/328), done.
remote: Total 557 (delta 290), reused 470 (delta 218)
Receiving objects: 100% (557/557), 76.38 KiB, done.
Resolving deltas: 100% (290/290), done.
=> Appending source string to /home/ubuntu/.profile
=> Close and reopen your terminal to start using NVM

Restart shell

exec $SHELL -l


List remote versions available for install

nvm ls-remote

To download, compile, and install the v0.8.19 release of node

nvm install 0.8.19

And then in any new shell just use the installed version

nvm use 0.8.19

Or you can just run it

nvm run 0.8.19

If you want to see what versions are available

nvm ls

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 0.8


Node Version Manager
    nvm help                    Show this message
    nvm install [-s] <version>  Download and install a <version>
    nvm uninstall <version>     Uninstall a version
    nvm use <version>           Modify PATH to use <version>
    nvm run <version> [<args>]  Run <version> with <args> as arguments
    nvm ls                      List installed versions
    nvm ls <version>            List versions matching a given description
    nvm ls-remote               List remote versions available for install
    nvm deactivate              Undo effects of NVM on current shell
    nvm alias [<pattern>]       Show all aliases beginning with <pattern>
    nvm alias <name> <version>  Set an alias named <name> pointing to <version>
    nvm unalias <name>          Deletes the alias named <name>
    nvm copy-packages <version> Install global NPM packages contained in <version> to current version

Bash Completion

To enable bash completion for nvm

source $NVM_DIR/bash_completion

OR put the above sourcing line just below the sourcing line for NVM in ~/.bash_profile or ~/.profile

[[ -r $NVM_DIR/bash_completion ]] && . $NVM_DIR/bash_completion

 The above works for all login shells, interactive and non-interactive.