Install NVM – Complete Node Version Manager Guide

To install NVM on Linux, macOS or WSL2, run the v0.41.0 install script from the nvm-sh repository, restart your terminal, then run nvm install --lts. Windows needs the separate nvm-windows installer instead. This guide covers both, plus the commands you need to switch Node.js versions.
Short version
# Ubuntu, macOS, WSL2
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.41.0/install.sh | bash
# restart your terminal, then:
nvm install --lts
nvm use --lts
node -v
# Windows (PowerShell): install nvm-windows first, then:
nvm install lts
nvm use ltsNode Version Manager is the most convenient way to manage different Node.js versions. We, as developers, oftentimes need to change between different Node.js versions depending on the project. Without Node Version Manager, changing Node.js versions can be cumbersome. In this article, you will learn how to: install NVM on Ubuntu, install NVM on macOS, install NVM on WSL2 and install NVM on Windows.
Table of Contents
- Short version
- Important NVM Commands
- Install Latest Node.js Version Using NVM
- Install Node.js LTS Using NVM
- List Available Node.js Versions
- Install Specific Node.js Version Using NVM
- Listing Installed Node.js Versions
- Switching Node.js Versions Using NVM
- Install NVM Windows
- Using NVM on Windows
- Install Latest Node.js Version on Windows
- Install Node.js LTS on Windows
- Install Specific Node.js Version on Windows
- Install NVM Ubuntu
- Verify Installation
- Install Latest Node.js Version on Ubuntu
- Install Node.js LTS on Ubuntu
- Additional Commands
- Install NVM WSL2
- Verify Installation
- Install Latest Node.js Version on WSL2
- Install Node.js LTS on WSL2
- Additional Commands
- Install NVM macOS
- Install NVM macOS Using Homebrew
- Install NVM macOS Using Curl or Wget
- Verify Installation
- Install Latest Node.js Version on macOS
- Install Node.js LTS on macOS
- Additional Commands
- FAQ
- Why does my terminal say "nvm: command not found"?
- How do I set a default Node.js version?
- How do I use a different Node.js version per project?
- Does NVM work on Windows?
- How do I update NVM?
- Summary
Important NVM Commands
The NVM commands are the same on every operating system except for Windows. Therefore, we are going to look at the most important NVM commands first to familiarize you with NVM. Note that nvm install also switches your current shell to the version it just installed.
The specific NVM Windows commands are listed in the Windows section.
Install Latest Node.js Version Using NVM
To install the latest version of Node.js, run:
nvm install nodeInstall Node.js LTS Using NVM
To install the LTS version of Node.js, run:
nvm install --ltsList Available Node.js Versions
To list all available Node.js versions that are supported in NVM, run:
nvm ls-remoteInstall Specific Node.js Version Using NVM
To install any other version of Node.js, run:
nvm install {version}Listing Installed Node.js Versions
To list all installed NVM versions, type:
nvm listSwitching Node.js Versions Using NVM
To switch/enable a version of Node.js, run:
nvm use {version}Install NVM Windows
NVM does not directly support Windows. Therefore we need to use the nvm-windows package instead (listed in the NVM documentation as a Windows alternative). It is a separate project with more than 48,000 GitHub stars.
To install NVM on Windows, download the installer for your CPU, for example nvm-2.0.1-x64-setup.exe, from the nvm-windows releases page. After downloading, run the installer as a normal user, not as Administrator, and leave everything as default. If you already have the official Node.js installed, the installer asks whether to adopt it into NVM or remove it. Alternatively, run winget install nvm-windows in PowerShell.
The screenshots in this section come from an older nvm-windows release, so the installer and the output look different now.

Using NVM on Windows
To use NVM on Windows, we need to use PowerShell.
- Press the Windows Key and search for PowerShell.
- Launch PowerShell.
- Run the
nvmcommand to verify that NVM is installed.

Install Latest Node.js Version on Windows
To install the latest Node.js version on Windows, run:
nvm install latestFollowed by the command below to activate it:
nvm use latest
Install Node.js LTS on Windows
To install the LTS version of Node.js on Windows, run:
nvm install ltsFollowed by the command below to activate it:
nvm use lts
Install Specific Node.js Version on Windows
To install any other version of Node.js on Windows, run:
nvm install {version}To use that particular version:
nvm use {version}Install NVM Ubuntu
Installing NVM on Ubuntu is quick & easy. We can use either curl or wget to install NVM on Ubuntu. Make sure to install the latest version by checking it in the official GitHub repository.
Curl
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.41.0/install.sh | bashWget
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.41.0/install.sh | bashRunning either of these commands will automatically update the respective ~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc files.
Make sure to restart your terminal after the installation has finished or run the source ~/.{yourProfile} command to update your config.
Verify Installation
To verify if everything was installed correctly, run:
nvm
Install Latest Node.js Version on Ubuntu
To install the latest Node.js version on Ubuntu, run:
nvm install node
nvm use {version}
Install Node.js LTS on Ubuntu
To install the LTS version of Node.js on Ubuntu, run:
nvm install --lts
nvm use {version}
Additional Commands
For more commands, check the important NVM commands section at the beginning of this article!
Install NVM WSL2
The steps to install NVM on WSL2 are the same as the steps for installing NVM on Ubuntu. Nevertheless, let’s quickly run through them. We can use either curl or wget to install NVM on WSL2. Make sure to install the latest version by checking it in the official GitHub repository.
Curl
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.41.0/install.sh | bashWget
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.41.0/install.sh | bashRunning either of these commands will automatically update the respective ~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc files.
Make sure to restart your WSL2 terminal after the installation has finished or run the source ~/.{yourProfile} command to update your config manually.
Verify Installation
To verify if everything was installed correctly, run:
nvm
Install Latest Node.js Version on WSL2
To install the latest Node.js version on WSL2, run:
nvm install node
nvm use {version}
Install Node.js LTS on WSL2
To install the LTS version of Node.js on WSL2, run:
nvm install --lts
nvm use {version}
Additional Commands
For more commands, check the important NVM commands section at the beginning of this article!
Install NVM macOS
There are two ways how to install NVM on macOS. You can either use Homebrew, or you install it by using either curl or wget.
Install NVM macOS Using Homebrew
If you do not have Homebrew installed, you can install it by using the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"To install NVM on macOS with Homebrew, run:
brew install nvmThe NVM project says Homebrew installs are not supported, so if you run into problems, use the curl or wget method below instead. The Homebrew formula also does not edit your shell profile for you. Create the NVM directory and add these lines to your ~/.zshrc (the path is /usr/local/opt/nvm on Intel Macs):
mkdir ~/.nvm
export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh"Install NVM macOS Using Curl or Wget
The classic way of installing NVM on macOS is by using the curl or the wget command.
Curl
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.41.0/install.sh | bashWget
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.41.0/install.sh | bashRunning either of these commands will automatically update the respective ~/.bash_profile, ~/.zshrc, ~/.profile, or ~/.bashrc files.
Make sure to restart your macOS terminal after the installation has finished or run the source ~/.{yourProfile} command to update your config manually.
Verify Installation
To make sure that NVM has been correctly installed on macOS, run:
nvm --version
Install Latest Node.js Version on macOS
To install the latest Node.js version on macOS, run:
nvm install node
Install Node.js LTS on macOS
To install the LTS version of Node.js on macOS, run:
nvm install --lts
nvm use {version}
Additional Commands
For more commands, check the important NVM commands section at the beginning of this article!
FAQ
Why does my terminal say “nvm: command not found”?
NVM is a shell function, not a program, so your shell has to load it at startup. Restart the terminal or run source ~/.zshrc (or ~/.bashrc). If it still fails, check that the installer added the NVM_DIR lines to the profile file your shell actually reads.
How do I set a default Node.js version?
Run nvm alias default lts/* to open every new terminal on the latest LTS, or nvm alias default node for the latest release. You can also pin a specific version, for example nvm alias default 24.
How do I use a different Node.js version per project?
Create a .nvmrc file in the project root containing a version such as lts/* or 24. Then run nvm use or nvm install inside that folder and NVM reads the file.
Does NVM work on Windows?
Not directly. On Windows you either run NVM inside WSL2 or install nvm-windows, which is a separate project. Its commands differ slightly, for example nvm install lts instead of nvm install --lts.
How do I update NVM?
Run the install script again with the newer version number from the NVM releases page. Your installed Node.js versions stay in place.
Summary
NVM is an excellent tool for managing Node.js versions in your various Web Development projects. If you want to get started with Web Development, make sure to check out our Web Development section.
This should get you up and running no matter on which OS you are. Should you have any kind of problems during the installation, make sure to check the troubleshooting section in the official GitHub repository of NVM.
More posts
All Web Development
