Upgrading Node.js with NVM
Everytime there a new Node.js version is released you tend to Google “upgrade nodejs” go to the first link that pops up and follow the procedure there. Now thanks to Creationix, we have a much more cleaner way to do this. Presenting NVM — Node Version Manager. With NVM you can now upgrade and manage multiple Node.js versions easily. There are various ways to install NVM based on your operating system. You will find the installation instructions here.
Using NVM
Once you have installed NVM use the following command to check if it has installed properly
$ nvm --version
The above command will output the version of NVM is it is successfully installed.
You can use the following command to check what versions of Node.js are installed on your local system
$ nvm ls
Following command is used to install a new Node.js version
$ nvm install 8.1.4 #Change 8.1.4 to desired Node.js version
To use a different Node.js version you can use the following command
$ nvm use 7.10.0 #Change 8.1.4 to desired Node.js version
To remove a specific version of Node.js just type in the following command
$ nvm uninstall 8.1.4 #Change 8.1.4 to desired Node.js version
NVM is really helpful in testing your Node.js applications across different versions. This makes your lives easier in making your apps backward or forward compatible so that they work seamlessly.