Another way of installing Node.js that is particularly flexible is to use nvm, the Node Version Manager. This piece of software allows you to install and maintain many different independent versions of Node.js, and their associated Node packages, at the same time.

#curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh

Take a look and make sure you are comfortable with the changes it is making. When you are satisfied, run the command again with | bash appended at the end. The URL you use will change depending on the latest version of nvm, but as of right now, the script can be downloaded and executed by typing:

#curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash

This will install the nvm script to your user account. To use it, you must first source your .bashrc file:

#source ~/.bashrc

Now, you can ask NVM which versions of Node are available:

#nvm list-remote

 
It’s a very long list! You can install a version of Node by typing any of the release versions you see. For instance, to get version v14.15.0, you can type:

#nvm install v14.15.0

You can see the different versions you have installed by typing:

#nvm list

 

#nvm use v14.15.0