Skip to content

How to install Node Version Manager ​

To conveniently manage different versions of Nodejs on our Ubuntu distribution, we'll use Node Version Manager or nvm.

Installing curl ​

We'll proceed to install it to be able to fetch the code we'll use to install nvm.

sh
sudo apt install curl

Downloading the installer ​

We run the following command that installs the necessary code to run nvm and enables it in our terminal's bashrc.

sh
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

Warning

The version in the command on this site may be outdated (0.39.1). Check the command in the project repository to get the most up-to-date version.

Verification ​

We run the following commands to verify that nvm was installed correctly.

sh
source ~/.bashrc
sh
command -v nvm

If the installation was successful, we should see the following in the console.

sh
nvm

Optional - Installing Node ​

We proceed to install the long-term support (LTS) version of node on our Ubuntu distribution.

sh
nvm install --lts

Once the installation is complete, we can verify the installed version of node with the following command.

sh
node -v

And we'll get a result like this.

sh
v16.15.1