Node Version Manager is a utility using which you can have multiple node versions on a single environment and can switch to whichever version you want for the moment. This post shows you the commands using which you can manage node versions on your machine using nvm.

nodejs upgrade  downgrade using nvm node management

Installation

Follow the instructions on the nvm repository on GitHub.

Usage

To install a version of node:

nvm install 8.10

To see the list of the installed nodejs versions:

nvm ls

Which will show you with a list like the following:

->      v8.10.0  
       v10.16.2  
default -> v8.10.0
node -> stable (-> v10.16.2) (default)
stable -> 10.16 (-> v10.16.2) (default)
iojs -> N/A (default)
lts/* -> lts/argon (-> N/A)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.16.1 (-> N/A)
lts/dubnium -> v10.16.3 (-> N/A)

To switch to another node version:

nvm use 10.16.3

To check which version is set as the default:

nvm alias default

To set another version as the default version:

nvm alias default 6.17.1

If you are done with a node version and want it gone, use the uninstall command:

nvm uninstall 4.9.1

Working with different node versions for different projects is a breeze when using nvm, which will take care of everything you need to manage regarding nodejs versions.