Skip to content

How to Install and Use NVM on Ubuntu 26.04 & 24.04

Install NVM on Ubuntu 26.04 or 24.04 LTS, then install Node.js LTS, switch between versions and set a default. Tested with NVM v0.41.0 and Node.js 26.

Steps
6
Covers
Node.js, NVM, Ubuntu
On this page 6 steps

Node Version Manager (NVM) is a command-line tool for installing and managing Node.js versions. It lets you install any Node.js release, run several versions side by side without conflicts, and switch between them per project. This is useful on developer machines and on servers that host applications built for different Node.js versions. NVM installs everything in your home directory, so you don’t need sudo for Node.js or global npm packages.

This tutorial shows how to install NVM on Ubuntu 26.04 LTS (Resolute Raccoon) and Ubuntu 24.04 LTS (Noble Numbat), and how to use it to manage your Node.js versions. The steps are the same on both releases.

Last tested: November 2026 with NVM v0.41.0, Node.js 26 LTS and Node.js 22 on Ubuntu 26.04 and Ubuntu 24.04.

Prerequisites

  • A system running Ubuntu 26.04 or Ubuntu 24.04 (desktop or server).
  • A user account with sudo privileges to install the required packages.
  • A terminal. On the desktop, press Ctrl + Alt + T to open one.

Step 1 of 6Update Ubuntu and Install Required Packages

Refresh the package index:

sudo apt update

Install curl to download the NVM installer, plus the libatomic library that Node.js 26 needs to start. Both are small, and minimal Ubuntu server and cloud images don’t always include them:

sudo apt install -y curl ca-certificates libatomic1

Step 2 of 6Install NVM on Ubuntu

Run the official install script as your normal user, not with sudo:

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

Or, using wget:

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.41.0/install.sh | bash

The script clones NVM into ~/.nvm and adds the lines that load it to ~/.bashrc (or ~/.zshrc if you use Zsh). Check the NVM releases page for a newer version number before you run it.

Step 3 of 6Load NVM and Verify the Installation

Close and reopen the terminal, or load NVM into the current session:

source ~/.bashrc

Verify the installation:

command -v nvm
nvm --version
nvm
0.41.0

Step 4 of 6Install Node.js with NVM

With NVM loaded, install the current Long Term Support (LTS) release of Node.js. This is the right choice for most projects:

nvm install --lts

NVM downloads a prebuilt binary, so this takes only a few seconds. You can install any other release by its major or full version number, for example Node.js 22:

nvm install 22

To see which versions you can install, list the LTS releases:

nvm ls-remote --lts

Check the active version of Node.js and npm:

node -v
npm -v

Step 5 of 6Switch Between Node.js Versions

List the versions installed on your system. The arrow marks the one in use:

nvm ls

Switch the current shell to another installed version:

nvm use 22

The change applies only to the current terminal session. Each project can also pin its own version: use an .nvmrc file in the project folder, and nvm use picks it up automatically.

Step 6 of 6Set a Default Node.js Version

New terminal sessions use the default version. Point it to the latest LTS release, so it moves forward when you install a newer LTS:

nvm alias default 'lts/*'

Or pin it to a specific major version:

nvm alias default 22

For more options, see how to set a default Node.js version with NVM.

Update or Uninstall NVM

To update NVM itself, run the install command again with the newer version number from the NVM releases page. Your installed Node.js versions are kept.

To remove a Node.js version you no longer need:

nvm uninstall 22

To remove NVM completely, delete its directory and then remove the three NVM lines from ~/.bashrc:

rm -rf ~/.nvm

Troubleshooting

nvm: command not found

The install script adds NVM to your shell profile, but the current session hasn’t read it yet. Reload the profile, or close the terminal and open a new one:

source ~/.bashrc

If it still fails, check that the NVM lines were added to the profile file. The installer only edits files that already exist, so create the file and run the installer again if needed:

grep NVM_DIR ~/.bashrc

error while loading shared libraries: libatomic.so.1

Node.js 26 binaries need the libatomic runtime library. Minimal server and container images often don’t include it, so node fails right after nvm install. Install the library and run node -v again; there is no need to reinstall Node.js:

sudo apt install -y libatomic1

Conclusion

NVM makes it simple to manage multiple Node.js versions on one Ubuntu machine. It is especially useful when your projects need different Node.js releases, or when you test an application against several versions. You now have NVM installed on Ubuntu 26.04 or 24.04, with Node.js LTS as the default. To learn more commands, see our complete guide to managing Node.js with NVM.

Rahul

Rahul Kumar is the founder and chief editor of TecAdmin.net. A Red Hat Certified Engineer (RHCE), he has worked in IT since 2009, with hands-on experience in Linux system administration, DevOps, web hosting, cloud platforms and automation. He started TecAdmin in 2013 to share practical, step-by-step guides, and leads its editorial work with one aim: making technical learning clear and useful for sysadmins, developers and beginners alike.

Leave a Reply

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


Back to top