How to install/update NVM and Node in Ubuntu
In this article, We are going to learn how to install NVM (Node Version Manager) and Node in Ubuntu.
Installing cURL
Before going to install the NVM, Please make sure you have installed the Curl. If not, install it by the following command
sudo apt install curl
Installing /updating NVM
To install or update nvm, you should run the install script. To do that, run the following cURL command
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
The above script clones the nvm repository to ~/.nvm
, and attempts to add the source lines from the snippet below to the correct profile file
Close and re-open your terminal to use/install the node by using NVM
Installing Node through the NVM
run the following command to install the node
nvm install 16.13.0
If you want to install the latest version of the node, Run the below command
nvm install node
You can list of download versions by following the command
nvm ls
You can switch the node version by running the following command
nvm use <version>
For Example, nvm use 16.13.0
To set the default node version,
When switching the version it will be expired when you close the currently active terminal. To make it default run the below comment
nvm alias default <verison>