How to Use Multiple Node.js Versions using NVM

Disclosure: This post may contain affiliate links, which means we may receive a commission if you click a link and purchase something that we recommended.

Pinterest LinkedIn Tumblr

How to Use Multiple Node.js Versions using NVM. NVM stands for Node.js Version Manager which is more flexible tool to install and manage multiple versions of Node.js and the associated packages at the same time.

In this guide you are going to learn how install specific version of Node.js using NVM. This setup is tested on Google Compute Engine running Ubuntu 20.04 OS

Install NVM

To install or update NVM you can use the curl command to download and execute the file. You can get the latest version from the nvm official repository. Copy the curl command from the readme section of the repo.

curl -o- | bash

This command will install NVM on your account. To use the tool you need to source your .bashrc file.

source ~/.bashrc

To verify the installation use the following command.

command -v nvm

If the installation is successful you should see the output as nvm.

List Node.js Versions

Once NVM is installed you can list all available Node.js versions using the ls-remote command.

nvm ls-remote

There will be a very long list to choose from. You can install any of the version listed here.

If you wish to install Node.js 12.18.3 version you cna simply use the install command with the specific version.

nvm install v12.18.3

Check the installtion using the default way.

node -v

can install a release based on these aliases as well. For example, to install the latest long-term support version, erbium, run the following.

nvm install lts/erbium

You can switch between any installed versions usingnvm use command.

nvm use v12.18.3

That’s it.


Now you have learned how to use NVM – Node Version Manager to install and use specif version of Node.js for your application.

Thanks for your time. If you face any problem or any feedback, please leave a comment below.

Write A Comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.