There is a few options for Node Version Manager or Virtual Envionment, below is their stats as of 28 Jan 2018.
| Name | Github Star | Issues | Last Release |
|---|---|---|---|
| nvm | 24401 | 179 | Dec 13, 2017 |
| n | 8526 | 76 | Dec 30, 2015 |
| nave | 1110 | 2 | Feb 14, 2017 |
Obviously I choose nvm.
Install nvm.
NOTE: installation with curl & bash is pretty scarry and dangerous, always skim through the file first.
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bashClose the current terminal and open a new terminal (to execute the startup script added to ~/.bashrc)
Check if nvm is installed properly.
command -v nvmInstall latest Node.js
nvm install node# Downloading and installing node v9.4.0...Install latest Node.js LTS.
nvm install --lts# Installing latest LTS version.# Downloading and installing node v8.9.4..Check current node version
nvm current # OR node -vList all installed node version
nvm ls# v8.9.4# v9.4.0# -> system# default -> systemSet system node (node installed at OS level, outside of nvm) as defaut
nvm alias default systemSet specific version as default
nvm alias default 8.9.4Set current node to default version
nvm use defaultSet current node to use system node
nvm use systemSet current node to specific version.
nvm use 8.9.4Set curent node to latest LTS.
nvm use node --ltsDeactivate nvm.
nvm deactivateReferences: