How do I install NVM on Linux?
Short answer: Run the official script with curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.41.0/install.sh | bash, then run source ~/.bashrc or open a new terminal. Check it with command -v nvm, install Node.js with nvm install --lts and switch versions with nvm use. It works the same on Ubuntu, Debian, Fedora, Arch and WSL, and you never need sudo.
nvm is a script that lives in your user folder (~/.nvm). It installs each Node.js version there too, so it does not touch the Node.js of your distribution and you can install global npm packages without sudo. The latest version is 0.41.0, from November 4, 2026.
On Ubuntu: install nvm with the script, load it, install Node.js 26 LTS and 24, and set the default version.
nvm on Linux at a glance
| What you want | Command |
|---|---|
| Install nvm | The official script (step 2) |
| Load it in the current terminal | source ~/.bashrc |
| Check that it is installed | command -v nvm |
| Install the latest LTS | nvm install --lts |
| Install a specific version | nvm install 24 |
| Switch version | nvm use 24 |
| Set the default version | nvm alias default 26 |
| List installed and available versions | nvm ls and nvm ls-remote --lts |
| Update npm to its latest version | nvm install-latest-npm |
Step 1: install curl
The script downloads with curl or wget. If you do not have either:
sudo apt update && sudo apt install curl # Ubuntu and Debian
sudo dnf install curl # FedoraThis is the only step that uses sudo.
Step 2: run the install script
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.41.0/install.sh | bashOr with wget:
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.41.0/install.sh | bashThe script clones nvm into ~/.nvm and adds these lines to your profile file, usually ~/.bashrc:
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvmThe same command updates nvm later: run it again with the new version number.
Step 3: load nvm and check it
The terminal you have open does not know nvm yet. Load it, or open a new terminal:
source ~/.bashrc
command -v nvmIf it prints nvm, it is ready. Use command -v and not which: nvm is a shell function, so which nvm prints nothing even when it works. If you use zsh, load ~/.zshrc instead.
Step 4: install Node.js and switch versions
nvm install --lts
nvm install 24
nvm lsnvm install --lts installs Node.js 26, the current LTS. To switch, and to choose the version every new terminal starts with:
nvm use 24
node -v
nvm alias default 26nvm use only changes the current terminal. nvm alias default is what makes the choice stick.
Install nvm on WSL
In WSL (Windows Subsystem for Linux), open your Ubuntu terminal and follow the same steps. Install nvm inside WSL, not NVM for Windows, and keep your projects inside the Linux file system (~/projects), not in /mnt/c, so npm runs faster.
