We’ll install Node.js with NVM (Node Version Manager). This lets us install any version of Node.js and then switch between them with one command.
To install nvm, issue the following at the terminal:
Logout and login again
Verify the installation
To verify that NVM is installed, make sure you logout and then log back in after the installation and then issue the following at the terminal:
List available versions
To list all the Node.js versions available for install, issue the following at the terminal:
The list is concatenated to illustrate the different versions available for install. You can pick the latest LTS version or the bleeding edge or something older.
Install Node.js LTS
To install the latest LTS version of Node.js, v10.16.3 as seen above, issue the following at the terminal:
To verify the Node.js installation, issue the following at the terminal:
The terminal will return the version of Node.js that is currently installed and in-use.
Install a different version
To install a different version of Node.js, simply issue the command nvm install followed by the version
To switch between the different versions of Node.js that you have installed, issue the following command followed by the version you want to switch to:
To find which versions are installed, issue nvm ls-remote and the returning list will list the installed versions in different colored text.