+1 (506) 500-5957 sales@monovm.com Get US VPS for 50% OFF!

How to Install NVM on Ubuntu: Step-by-Step Guide

In this tutorial, learn how to install NVM on Ubuntu and take advantage of the flexibility and power of Node.js. Follow our step-by-step guide and start building dynamic web applications with ease.

Posted: 03 Apr, 23 Updated: 23 Jun, 23 by Susith Nonis 5 Min

List of content you will read in this article:

Node Version Manager (NVM) is a versatile tool that allows developers to install and manage multiple versions of Node.js on a single machine. This can be especially useful when working with projects that rely on different versions of Node.js. Installing NVM on Ubuntu is a relatively simple process that can be completed in just a few steps. In this guide, we will walk you through the process of installing NVM on Ubuntu machine(Install NVM Ubuntu) and show you how to use it to install and manage different versions of Node.js.

Node.js is an open-source, cross-platform JavaScript runtime environment built on Chrome's V8 engine. It enables developers to execute JavaScript code outside a web browser and provides a fast and efficient way to build scalable network applications.

Node.js has gained widespread popularity among developers due to its lightweight and efficient nature, making it an ideal choice for building highly responsive and real-time web applications. Node.js features a large and growing library of modules that can be easily integrated into applications, and its community of developers is continually improving its functionality and performance.

NVM plays an important role in the Node.js ecosystem by allowing developers to manage multiple versions of Node.js on a single machine easily. This is incredibly useful for developers who work on multiple projects and need to switch between different versions of Node.js without having to uninstall and reinstall each time.

NVM provides a command-line interface to manage different versions of Node.js and allows developers to switch between them easily. It also provides a simple way to install and test pre-release versions of Node.js, making it an essential tool for developers who want to stay up-to-date with the latest features and functionality. NVM is a powerful and versatile tool that helps developers manage their Node.js environments more efficiently and effectively.

sudo apt-get install curl

  • Next, install Node.js version 12.x by running the following command:

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -

  • Install Node.js version 12.x by running the following command:

sudo apt-get install -y nodejs

  • Verify that Node.js version 12.x is installed by typing the following command:

node -v

  • Next, install the Node Version Manager (nvm) by running the following command:

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

  • Close and reopen the terminal to activate NVM.
  • Verify that NVM is installed by typing the following command:

command -v nvm

  • Use NVM to install the latest version of Node.js by typing the following command:

nvm install node

  • Verify that the latest version of Node.js is installed by typing the following command:

node -v

That's it! Now you have successfully installed Node Version Manager on your Ubuntu system.

  • Use specific version: Once you have installed multiple versions of Node.js, you can use a specific version by using the command `nvm use` followed by the version number. For example, “nvm use 10.15.3” will switch to Node.js version 10.15.3.
  • Set default version: You can also set a default version of Node.js using the command “nvm alias default” followed by the version number. For example, “nvm alias default 10.15.3” will set Node.js version 10.15.3 as the default version.
  • List installed versions: To view a list of all the Node.js versions installed on your machine, use the command “nvm ls”.
  • Uninstall a version: To uninstall a specific version of Node.js, use the command “nvm uninstall” followed by the version number. For example, “nvm uninstall 10.15.3” will uninstall Node.js version 10.15.3 from your machine.

NVM is a powerful and flexible tool for managing Node.js versions on Ubuntu. Installing it requires following a few simple steps, which have been outlined in this guide. With NVM, developers can easily install multiple versions of Node.js, switch between them as needed, and ensure compatibility with their projects. Whether you are a beginner or an experienced developer, NVM is an essential tool that will help you streamline your workflow and improve the quality of your work. So, go ahead and try installing NVM on Ubuntu today!

  • NVM simplifies the management of Node.js versions on Ubuntu, allowing developers to switch between different versions for their projects easily.
  • Installing NVM requires using the terminal and running a few simple commands, which can be completed by following the steps outlined in this guide.
  • Once installed, NVM provides a range of benefits, including improved compatibility with different versions of Node.js and enhanced workflow flexibility for developers.
  • NVM is compatible with Ubuntu and can be used with other Linux distributions and macOS, making it a versatile and valuable tool for developers across different environments.

People also read: 

Frequently Asked Questions

NVM is a tool used to manage Node.js versions on Ubuntu.

You can install NVM by using the command-line interface and following a few simple steps outlined in this guide.

NVM allows developers to install multiple versions of Node.js easily, switch between them as needed, and ensure compatibility with their projects.

Yes, NVM is compatible with other Linux distributions and macOS.

While NVM may seem intimidating initially, it is fairly straightforward to use and can benefit developers of all skill levels significantly.

Susith Nonis

Susith Nonis

I'm fascinated by the IT world and how the 1's and 0's work. While I venture into the world of Technology, I try to share what I know in the simplest way with you. Not a fan of coffee, a travel addict, and a self-accredited 'master chef'.