How To Install Multiple Version Of Node.js

January 30, 2018

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- | bash

Close the current terminal and open a new terminal (to execute the startup script added to ~/.bashrc)

Check if nvm is installed properly.

command -v nvm

Install 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 -v

List all installed node version

nvm ls
#          v8.9.4
#          v9.4.0
# ->       system
# default -> system

Set system node (node installed at OS level, outside of nvm) as defaut

nvm alias default system

Set specific version as default

nvm alias default 8.9.4

Set current node to default version

nvm use default

Set current node to use system node

nvm use system

Set current node to specific version.

nvm use 8.9.4

Set curent node to latest LTS.

nvm use node --lts

Deactivate nvm.

nvm deactivate


This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.