How to Install Latest Node Version Manager NVM and Install Node and NPM in macOS Mac OS X Nodejs node package manager (NPM) node.js
Sierra,Mojave
a)
#Install command line developer tools.
$ xcode-select --install
b)
Install latest version of NVM
https://github.com/creationix/nvm#git...
-- Clone NVM
$ cd ~/
$ git clone https://github.com/creationix/nvm.git .nvm
-- Checkout latest version of nvm
$ cd ~/.nvm
$ git checkout v0.33.11
-- Activate NVM
$ . nvm.sh
-- Now add these lines to your ~/.bashrc, ~/.profile, or ~/.zshrc file to have it automatically sourced upon login:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
c)
List your installed node versions:
$ nvm list
d)
List the available node versions in the cloud:
$ nvm ls-remote
$ nvm ls-remote | tail -n9
e)
Install node of version 10.6.0
$ nvm install 10.6.0