This is a guide to installing node js on a Ubuntu machine. You can keep multiple versions of node simultaneously and switch between them as per the requirement.
Follow the below steps for installation :
Run the command ensuring your system is up to date.
sudo apt update
To install the latest stable version, run the command
sudo snap install node --classic
or Visit the Official Snap website to see the list of available versions.
To confirm the installed version of node, run the command
In case you wish to have more than one version of node installed. Run the command
nvm install v19.9.0
Here v19.9.0 is used as an example and can be replaced by a version of your choice!
To see all the available versions, use the command
To see the list of node versions that are installed on your pc, run the command
To switch between the versions of node, run the command
nvm use v19.9.0
Here v19.9.0 can be replaced with any other version of node that is installed on the system.
Thanks for reading this. I hope this was helpful. Any comments or reactions will be wholeheartedly appreciated.