If you already have Node installed, uninstall it!
2: Install nvm
Install nvm using the "install.sh” script provided by the nvm team. Do not install nvm via homebrew, as it is not supported.
3: Configure nvm
Add the following to
$HOME/.zshrc, or your shell’s equivalent configuration file:
export nvm_DIR="$HOME/.nvm” # Load nvm [ -s "$nvm_DIR/nvm.sh" ] && . "$nvm_DIR/nvm.sh" [[ -r $nvm_DIR/bash_completion ]] && . $nvm_DIR/bash_completion
4: Using nvm
To download, compile, and install a specific version:
$ nvm install 4.0 $ nvm install 0.12 $ nvm install 0.10
Switching versions is easy:
$ nvm use 0.12
Step 5: Settings
~/.nvmrc file to define your prefered version globally. The contents of the file is simply the version you want to default to. For example:
$ echo "0.12" > .nvmrc
This is just a brief outline of installing and using nvm. Visit the official nvm site for complete documentation.