NVM is basically the version manager for Node.js. With the help of NVM we can install and use multiple versions of Node.js along with NPM. If we have multiple Node.js projects having various versions of node and npm then always install node using NVM only.
First download the NVM installation script using cURL as follows
$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
After downloading the script, run the script using bash as follows
$ bash install_nvm.sh
To reflect the changes for the current user session, use following command
$ source ~/.profile
Check installed NVM version as follows
$ nvm --version
Use following nvm command to list all available node.js versions
$ nvm ls-remote
It shows the output as follows
$ nvm install 10.15 # it will install node 10.15.0
To see all installed node version, use nvm list as follows:
To use particular node version use
$ nvm use 10.15 # it will use node 10.15.0
To check node and npm version, use following commands:
$ node -v$ npm -v
Now successfully installed the Node.js and npm using NVM. It will be very useful to manage the various nodejs projects having different node versions. Hope this guide help you in installation of node in ubuntu environment.
Thank you!!!