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

Learn how to install NVM on Ubuntu easily! Follow our user-friendly guide for seamless Node.js version management. Click for simple, step-by-step instructions!

Updated: 13 Feb, 24 by Susith Nonis 12 Min

List of content you will read in this article:

Node.js, an integral part of server-side JavaScript, thrives on its adaptability. However, efficiently juggling various Node.js versions becomes paramount for developers. Enter Node Version Manager (NVM), a powerful tool designed explicitly for Ubuntu users. This comprehensive guide helps you learn how to install NVM on Ubuntu.

Gain mastery over version control as you navigate through the simple yet potent steps of installing and effortlessly switching between Node.js versions on Ubuntu, all through the adept utilization of NVM. Unleash the potential of NVM to simplify and enhance your Node.js development journey.

Node.js is an open-source, server-side JavaScript runtime environment built on Chrome's V8 JavaScript engine. Created by Ryan Dahl in 2009, Node.js allows developers to execute JavaScript code outside a web browser, enabling server-side scripting and the development of scalable, high-performance network applications.

Key features of Node.js include its event-driven architecture and non-blocking I/O model, which allows for handling a large number of concurrent connections efficiently. This architecture makes Node.js well-suited for building real-time applications, such as chat applications, gaming servers, streaming platforms, and APIs.

Node Version Manager (NVM Full Form) stands as a versatile and indispensable tool for developers navigating the complexities of Node.js version management. Essentially, NVM serves as a robust utility designed to facilitate the seamless installation, switching, and management of multiple Node.js versions within a single system environment. This open-source tool offers a command-line interface, enabling users to effortlessly control and manipulate Node.js versions as per project requirements.

At its core, NVM empowers developers working on diverse projects by providing an efficient means to install, uninstall, and switch between different Node.js versions without the hassle of manual setup. It simplifies the process of handling Node.js versions, allowing for enhanced flexibility in development workflows. By encapsulating each Node.js version within its isolated environment, NVM enables users to isolate dependencies and configurations, ensuring a clean and efficient environment for each project. In the next sections, we’ll show you how to install NVM in Ubuntu.

Ready to streamline your Node.js management? Click here to learn the step-by-step guide on installing NVM on Ubuntu and elevate your development experience!

Before diving into the installation of Node Version Manager (NVM) on Ubuntu, ensure your system meets the following prerequisites:

  1. Active Ubuntu 20.04 Server: Ensure you have an active Ubuntu 20.04 server environment ready for installation.

Need an Ubuntu VPS? Choose MonoVM for reliability and performance!

  1. Package Manager (apt): Verify that the apt package manager is installed on your Ubuntu system. This package manager is essential for fetching and managing software packages.
  2. Curl Installed: Confirm the presence of the curl command-line tool. If not installed, you can acquire it via the package manager by executing sudo apt install curl.
  3. Root or Sudo Access: Ensure you possess administrative privileges or sudo access to execute privileged commands required for installation and setup.

To install Node Version Manager (NVM) on Ubuntu and manage multiple Node.js versions, follow these steps:

Step 1: Update the System

First, ensure your system is up-to-date by running the following command:

sudo apt update

Step 2: Download and Install NVM

Once the system is updated, download and install NVM using curl:

curl -o- | bash

Step 3: Check NVM Version

Verify the NVM version installed with:

nvm --version

Step 4: Install Node.js using NVM

After installing NVM, proceed to install the latest Node.js version:

nvm install node

Step 5: Check Node.js Version

Confirm the installed Node.js version by running:

To learn more about managing your Node.js environment, check out our guide on how to check Node.js version

node --version

Step 6: Install Current LTS Version

To install the current LTS version of Node.js without specifying the version number, use:

nvm install --lts

Step 7: Install a Specific Node.js Version

To install a specific Node.js version (e.g., version 11.5), execute:

nvm install 11.5

Step 8: List Installed Node.js Versions

View all installed Node.js versions with:

nvm ls

Step 9: Switch Node.js Version

Switch between installed Node.js versions. For instance, switch to version 14.10.0 using:

nvm use v14.10.0

🚀 Stay Ahead of the Curve! 🚀
Click Here to Learn How to Update Your Node.js to the Latest Version!

Step 10: Uninstall a Node.js Version

To uninstall a particular Node.js version (e.g., version 11.5), use:

nvm uninstall 11.5

Step 11: Install Stable Node.js Version

To install the stable version of Node.js, execute:

nvm install stable

Now, you have successfully learned how to install NVM on Ubuntu and managed to install a specific version of Node.js. You can switch between installed Node.js versions using nvm use <version_number> and manage them according to your project requirements.

1. Installing Specific Node.js Version

After completing the Ubuntu install NVM process, use the command to install a particular Node.js version (e.g., version 12.18.3):

nvm install 12.18.3

2. Setting Default Node.js Version

Set a default Node.js version for new terminal sessions:

nvm alias default 12.18.3

3. Switching Between Node.js Versions

Use a specific Node.js version in the current terminal session:

nvm use 12.18.3

4. Listing Installed Node.js Versions

  • Display all installed Node.js versions on the system:

nvm ls

5. Uninstalling a Node.js Version

Uninstall a specific Node.js version (e.g., version 10.15.3):

nvm uninstall 10.15.3

6. Installing Latest LTS (Long Term Support) Node.js Version

Install the current LTS version of Node.js:

nvm install --lts

7. Installing Stable Node.js Version

Install the stable version of Node.js:

nvm install stable

After learning how to install NVM on Ubuntu, these commands empower you to effortlessly install, manage, and switch between different Node.js versions on your Ubuntu system using Node Version Manager (NVM). Adjust the version numbers according to your project requirements and utilize these commands in your terminal for efficient version control.

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

To update NVM to its latest version, you can use the curl command similar to the installation command:

curl -o-$(curl -s | grep 'tag_name' | cut -d\" -f4)/ | bash

This command fetches and runs the install script from the latest release on GitHub.

To uninstall NVM, you need to remove the NVM directory, which is typically located at ~/.nvm. You can do this by running

rm -rf ~/.nvm

Additionally, you should remove any NVM lines from your shell profile file (such as .bashrc, .bash_profile, or .zshrc) to completely remove NVM from your system.

When managing multiple versions of Node.js, developers have several tools at their disposal, each with its own set of features and advantages. The most popular among these are Node Version Manager (NVM), n, and fnm. Understanding the differences and similarities between these tools can help developers choose the one that best fits their workflow.

Node Version Manager (NVM)

  • Compatibility: NVM is highly compatible with Linux, macOS, and WSL (Windows Subsystem for Linux). It does not support native Windows environments without WSL.
  • Ease of Use: Offers a straightforward command-line interface for installing, managing, and switching between Node.js versions.
  • Isolation: Each Node.js version is installed in its own directory, with global packages not shared between versions. This ensures that projects remain independent and reduces conflicts between different Node.js versions.
  • Installation: Does not require root access for installation or for managing Node.js versions, making it safer and more accessible for users without administrative privileges.
  • Drawbacks: Can be slower than some alternatives because it fully switches environments for each Node.js version.


  • Compatibility: Designed primarily for Linux and macOS users. Its simplicity and ease of use make it a popular choice, though it lacks the full compatibility layer that NVM offers with WSL for Windows users.
  • Ease of Use: Provides a more minimalistic approach compared to NVM, focusing on simplicity and speed. It allows for quick switching between versions without the need for modifying environment variables manually.
  • Global Packages: Unlike NVM, n stores Node.js versions in a centralized location, and global packages can be shared across versions. This can be convenient but may lead to conflicts if different projects require different versions of the same package.
  • Installation: Requires sudo access for installing Node.js versions, which may not be suitable for all environments.

fnm (Fast Node Manager)

  • Compatibility: Works well on Linux, macOS, and Windows. It's designed to be fast and efficient, leveraging parallel downloading and caching to speed up installations.
  • Ease of Use: Offers a simple and efficient command-line interface. It's particularly noted for its performance, being faster than both NVM and n in many cases.
  • Installation: Like NVM, it does not necessarily require root access for managing Node.js versions, making it user-friendly and secure.
  • Features: Supports .nvmrc files for automatic version switching based on project requirements, similar to NVM. It's built in Rust, which contributes to its speed and efficiency.
  • Drawbacks: While it's faster and more efficient, fnm might not have as extensive version compatibility checks as NVM, which can lead to issues in very specific use cases.

Node Version Manager (NVM) is a really useful tool for handling different versions of Node.js on your Ubuntu system. It's not hard to install – you just need to follow a few easy steps mentioned in this guide. With NVM, developers can easily set up and switch between various Node.js versions, making sure they work smoothly with their projects.

 It doesn't matter if you're new to coding or have been doing it for a while, NVM is a great tool that helps you organize your work better and improve how you get things done. So, why not give it a try and install NVM on your Ubuntu system today?

NVM makes it easy for developers to switch between different Node.js versions for their projects. You'll need to use the terminal and run some simple commands, as explained in this guide about how to install NVM on Ubuntu.

Once you’ve completed the install NVM Ubuntu process, it brings several benefits like better compatibility with various Node.js versions and more flexibility in how you work, which can help improve your overall workflow. Plus, NVM works well not just with Ubuntu but also with other Linux systems and macOS, so it's a versatile tool you can use across different environments as a developer.

People Also Reading:

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.

NVM is designed to be a per-user installation, managing Node.js versions within a user's home directory. To manage Node.js versions for multiple users, each user would need to install NVM separately in their own environment.

Yes, you can install a specific version of NVM by specifying the version tag in the install command. Replace v0.35.3 in the curl command with the desired version tag: curl -o- | bash.

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'.