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.
sudo apt install curlDownloading the installer
We run the following command that installs the necessary code to run nvm and enables it in our terminal's bashrc.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bashWarning
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.
source ~/.bashrccommand -v nvmIf the installation was successful, we should see the following in the console.
nvmOptional - Installing Node
We proceed to install the long-term support (LTS) version of node on our Ubuntu distribution.
nvm install --ltsOnce the installation is complete, we can verify the installed version of node with the following command.
node -vAnd we'll get a result like this.
v16.15.1
