In this tutorial, you will learn how to install Nodejs NVM and how to use it in switching between more than one node.js version. you can install node js from this page.

NVM stands for node version manager, used to manage all installed node.js versions on the machine. And it is easy to switch between all node.js versions.

Node.js is an open-source and javascript runtime environment built in Google V8 Chrome’s JavaScript Engine to help users in network applications working outside the browser client and create server-side web applications.

Install Nodejs NVM on Windows

To install NVM on windows, you have to navigate to this page and download the program then follow the next steps one by one.

NVM Setup

Once download the program just double-click and follow the next steps

NVM For Windows

In the above image, you will see the terms and conditions screen just click on “I accept the agreement” regarding the license agreement and then click on the “next” button.

install nvm on windows.

On this screen, you have to select the path of installation. Otherwise, remain it as a default path and then click on the “next” button.

In the below down image you have to select the path of the Node.js folder to add “symlink” if the default path is the right location for Node.js remain the default path that already has been created from the installation program.

symlink nvm folder

Then it will show you the final installation screen just click on the “install” button. If you already have Node.js on your machine it will show you a confirmation message just click on the yes” button.

Install NVM on Ubuntu

If you don’t have curl you have to install it. Just use the terminal to execute the below-down command.

-- Update Ubuntu Package
sudo apt-get update

-- Install curl
sudo apt install curl

In the next step, you have to download and set up the nvm file ended with “sh” from the githubusercontent.

-- Download and install sh app using curl
sudo curl -o- | bash

Or you can use the “wget” command

-- Download and install  sh app using wget
sudo wget -qO- | bash

Once you execute the previous command it will clone the nvm repository into “~/.nvm“.

In the following command, we will correct the profile file.

export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/" ] && \. "$NVM_DIR/" # This loads nvm
source ~/.profile

Verify The NVM Installation

To verify the installation use the below command

command -v nvm
Verify Node Version Manager Installation

NVM Usage Commands

As we mentioned before, we can use the nvm to manage node versions and switch between all versions that are already installed in the same machine. Let’s focus slightly on commands on how to do that.

NVM list All Node.js Versions

To list all currently installed node versions use the below command.

nvm ls

The below image shows you all the current versions that are already on this machine.

Node Version Manager list command

Install Node.js Version

But the question is, how can we install and download a new version for Node.js using the node version manager command? the command is similar to npm command but instead of npm word use nvm with the version number.

nvm install 15.0.0
Node Version Manager install node.js version

Switch Between Node.js Versions

Our current active version already on our machine is version “16.15.1”. our mission is to switch the current version into another old version. we will switch to version “15.0.0” using the below command.

nvm use 15.0.0
nvm use node.js-version command

The Common Issues

  • If you faced any problem in switching like an access denied message just re-runs the node.js prompt command as administrator “Run as Administrator“.
nvm use issue
  • If you faced an issue like “The current directory is no empty” you have to open the path of the Node.js folder and commonly is located on this path “C:\Program Files\nodejs” and then change the “nodejs “folder name to “nodejsx“. To be like this “C:\Program Files\nodejsx” then rerun the command again.

Nvm Help

To explore all node version manager commands just run “nvm -h“. It will show you all commands.

nvm help


The nvm stands for Node Version manager

We learned how to install node version manager on windows, ubuntu also learned how to install a new node.js version using the node version manager command and switch between all node.js versions.

Otherwise, we explained some problems maybe you will face during the use of the “nvm use” command and how to solve those problems.