IMPORTANT: If you have previously installed node using HomeBrew, ensure that you uninstall it before you proceed:
brew uninstall --force node
git clone git://github.com/creationix/nvm.git ~/.nvm
printf "\n\n# NVM\nif [ -s ~/.nvm/nvm.sh ]; then\n\tNVM_DIR=~/.nvm\n\tsource ~/.nvm/nvm.sh\nfi" >> ~/.bashrc
NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
ON OSX if you may encouter the error nvm not found
,
open ~/.bash_profile
and add this:
source ~/.bashrc
nvm --version
nvm install 5.7.0
nvm install 5.5.0
nvm install 5.3.0
nvm install 4.2.0
nvm install 0.12
nvm install node --reinstall-packages-from=node
nvm use 0.12
nvm alias default v6.11.1
nvm ls
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.
echo "6.11" > .nvmrc