
Install NVM on Ubuntu 20.04
Node Version Manager (NVM) is a tool that allows us to manage multiple versions of Node.js. Thanks to NVM we can install the most recent versions of node.js including npm or install a specific version and be able to switch between versions easily from the command line.
Previously we learned how to install WSL2 on Windows 11 now we are going to install Node.js through NVM to work on our projects built in JavaScript within the Ubuntu 20.04 configuration that we installed with WSL2 on Windows 11.
Install NVM on Ubuntu 20.04
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bashNow we are going to activate the environment variable for NVM with the following command:
source ~/.bashrcNow let’s verify that we have NVM installed and working.
nvm --versionInstall Node.js in its latest version
nvm install node
Now we check that we have Node.js and npm installed.
node --version | npm --versioninstall a specific version of Node.js
nvm install 14.18.1 // Node LTSList installed versions
nvm lsSwitch between Node.js versions
nvm use 14.18.1 | 16.11.1Delete a version of Node.js
nvm uninstall 14.18.1NVM allows us to correctly install and manage the versions of Node.js that we need for our projects.

Note: If you are working with zsh or some other profile in your GNU/Linux operating system, you must activate the NVM environment variable.
More information in the GitHub repository: nvm-sh/nvm

