If you're using Node.js on your Ubuntu machine or any other Linux distribution, you might want to consider using Node Version Manager (NVM) alongside it, which will let you install and manage multiple versions of Node.js and switch between them. This is important because, during the development process, you might come across a project that needs a different Node.js version. That's why today we'll guide you through the process of installing NVM on Ubuntu Linux.

How to install NVM on Ubuntu

To install NVM on Ubuntu, you have to work in the terminal. You'll also have to install the Curl extension to your terminal to fetch a batch script to grab the latest version.

  1. Launch the terminal with Ctrl + Alt + T.
  2. Run the command: sudo apt install curl
  3. Run the command: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash.
  4. If the command doesn't work, check GitHub for the latest command.
  5. Restart the terminal.
  6. Double-check to see if NVM is installed with: command -v nvm

Next steps

Congratulations! You now have NVM on your Ubuntu system, but there are still some additional things to remember. Once you install NVM, there are some commands you'll want to use. You can install the latest version of Node.js by using the command: nvm install node. You can also install a specific version by using the command nvm install XX.XX.X replacing XX.XX.X with the version you want. To see all installed node versions, use the command nvm ls. To use a specific version, meanwhile, consider the command nvm use XX.XX.X replacing XX.XX.X with the version number.

That's pretty much everything to know about using NVM on Ubuntu. It's just one developer tool on Ubuntu. There are also things like AWS CLI and even Nginx.