Skip to content

How to Install NVM on Debian 13 & 12

Install NVM on Debian 13 (Trixie) or Debian 12 (Bookworm), then install Node.js LTS, switch between versions and set a default. Tested with NVM v0.41.0.

Steps
6
Covers
Debian, NVM
Versions & support
About Debian →
On this page 6 steps

Node Version Manager (NVM) is a command-line tool that installs and manages multiple versions of Node.js on one machine. Instead of installing Node.js from the Debian repositories, which ship a single and often older version, NVM lets you install any release in seconds and switch between them per project or per terminal session. Everything is installed in your home directory, so you don’t need sudo to install Node.js or global npm packages.

This guide shows how to install NVM on Debian 13 (Trixie) and Debian 12 (Bookworm). 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 Debian 13 and Debian 12.

Prerequisites

  • A system running Debian 13 or Debian 12 (desktop, server or cloud instance).
  • A user account with sudo privileges to install the required packages.
  • An internet connection to download NVM and Node.js.

Step 1 of 6Update Debian and Install Required Packages

Open a terminal and refresh the package index:

sudo apt update

Install curl to download the NVM installer, along with the CA certificates and the libatomic library. Node.js 26 needs libatomic to start, and minimal Debian installations don’t always include it:

sudo apt install -y curl ca-certificates libatomic1

You don’t need build-essential for a normal installation, because NVM downloads prebuilt Node.js binaries. Install it only if you plan to compile Node.js from source with nvm install -s.

Step 2 of 6Install NVM on Debian

Run the official install script. Run it as your normal user, not with sudo, because NVM installs into your home directory:

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

If you prefer wget, this command does the same thing:

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 your shell profile (~/.bashrc for Bash, ~/.zshrc for Zsh). Check the NVM releases page for a newer version number before you run it.

Step 3 of 6Load NVM and Verify the Installation

Load NVM into the current terminal session, or close the terminal and open a new one:

source ~/.bashrc

Verify that NVM is available:

command -v nvm
nvm --version
nvm
0.41.0

The first command prints nvm because NVM is a shell function, not a binary file.

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

You have installed NVM on Debian and used it to install Node.js, switch between versions and set a default. The same commands work on Debian 13 and Debian 12, and NVM keeps every project on the Node.js version it needs without touching the system packages. 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