Skip to content
Follow
Ubuntu Linux

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

Richard
Written by
Richard
Oct 20, 2022 Updated Sep 15, 2026 3 min read
How to Install Nextcloud AIO on Ubuntu Linux
How to Install Nextcloud AIO on Ubuntu Linux

Node Version Manager (NVM) is a command-line tool that lets you install and switch between multiple versions of Node.js on Ubuntu. Different web projects often need different versions of Node.js to run properly, and NVM stops you from having to uninstall and reinstall software every time you switch tasks.

Advertisement

You can install a specific release like Node.js 20.11.0 in seconds and switch back to an older version whenever a project requires it. The tool installs directly into your user account, keeping your setup clean and safe from system-wide conflicts.

⚡ Quick Answer

Install NVM by running the provided cURL or Wget command from the official NVM GitHub repository. After the script finishes, reload your shell configuration by running `source ~/.bashrc` to activate NVM.

Advertisement

How to install nvm on Ubuntu Linux

As mentioned above, nvm allows you to quickly install and use different versions of nodes via the command line.

The steps below show you how to do that on Ubuntu Linux.

Install nvm

You can install nvm (Node Version Manager, a tool that lets you manage multiple versions of Node.js) on Ubuntu by running a single download script in your terminal. Paste the official curl or wget command into your command line and press Enter to fetch the setup script, which automatically configures everything you need to start using nvm on your system.

cURL command:

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

Wget command:

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
📝Good to KnowEither of the commands above should download the nvm install script that can be used to install.

The script clones the nvm repository to ~/.nvm, and attempts to add the source lines from the snippet below to the correct profile file (~/.bash_profile~/.zshrc~/.profile, or ~/.bashrc).

After installing, the script should output the lines below.

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
📝Good to KnowOnce downloaded, you can then activate and reload your shell environment.

By default, it's bash (~/.bashrc).

Advertisement
source ~/.bashrc

To check the version of nvm installed, run the commands below.

nvm --version

Install Node.js with nvm

You can install Node.js with nvm on Ubuntu by running the nvm install command in your terminal. This downloads and sets up the latest or a specific version of Node.js for your user account without needing root permissions, letting you switch between different software versions whenever your projects require it.

Run the commands below to download and install the current and latest version of node.js.

nvm install node

Once installed, you can check the version of node.js installed by running the commands below.

Advertisement
node --version

Run the commands below to install the latest stable version (long-term support).

nvm install node --lts

To install a specific version (12.17.0), run the commands below.

nvm install 12.17.0

To list all available versions in the repository, run the commands below.

nvm ls-remote

If you have multiple versions of node.js installed, run the commands below to specify the version you want to use.

Advertisement
nvm use 12.17.0

To find the current default node.js installed, run the commands below.

nvm run default --version

Uninstall node.js

You can uninstall Node.js using nvm on Ubuntu by running the nvm uninstall command followed by the exact version number you want to remove. This safely deletes that specific release from your machine while leaving nvm and your other installed Node.js versions untouched and ready to use.

nvm uninstall v12.17.0

That should do it!

Conclusion:

  • Nvm is a valuable tool for developers to manage multiple versions of node.js on their systems easily.
  • By following the installation instructions, developers can quickly install and use different versions of node.js via the command line.
  • The provided guide simplifies installing nvm on Ubuntu Linux and showcases how to install and manage node.js using nvm.
  • Users are encouraged to provide feedback or suggestions for improvement through the comment section below.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

Advertisement

📚 Related Tutorials

How to Turn "Week Numbers" On or Off for Calendar in Ubuntu Linux
Ubuntu Linux How to Turn "Week Numbers" On or Off for Calendar in Ubuntu Linux
Install Node.js and npm on Ubuntu: A Step-by-Step Guide
Ubuntu Linux Install Node.js and npm on Ubuntu: A Step-by-Step Guide
How to list Services on Ubuntu Linux
Ubuntu Linux How to list Services on Ubuntu Linux
How to Install ProjectSend with Nginx on Ubuntu Linux
Ubuntu Linux How to Install ProjectSend with Nginx on Ubuntu Linux

No comments yet — be the first to share your thoughts!

Leave a Comment

Your email address will not be published. Required fields are marked *