Join us on the demo, while our product experts provide a detailed walkthrough of our enterprise platform.

How do I install multiple node js version on the same machine

In this blog, we will get to know and learn about running multiple node js version on the same machine with NVM .

Mayank Agarwal
Mayank Agarwal
May 04, 2021
2 min read

While working on the multiple projects of NodeJs, you might be required to run different projects on the different nodejs version or for the legacy nodejs projects, you might require an old version of the nodejs, and the others required a new version of node-js, or to checkout the new feature of nodejs, you need to install the latest version of node js

As on the same machine, we can only install one version of the nodejs, so it's very painful to uninstall and install the new node version as per your project requirements.

To overcome this problem, we can use the Node Version Manager (NVM). NVM allows installing multiple node js versions on the same machine and switching between the required node js version.

Installation of NVM

Windows

Download the latest version of NVM

https://github.com/coreybutler/nvm-windows/releases/latest

Download nvm-setup.zip and install on the windows

Verify Installation

nvm version

MacOs/Linux

Using curl

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

Using Wget

wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash

Verify Installation

command -v nvm

Usage

Get a List of all available NodeJs versions

nvm  ls available //windows

nvm ls-remote //MacOs/Linux

Install latest NodeJs version

nvm install node

Install latest LTS Release

nvm install --lts

Install particular NodeJs version

Multiple NodeJs version can be installed using the below command.

nvm install 8.11.1 // to install the 8.11.1 version

nvm install 12.13.1 //to install the 12.13.1 version

UnInstall the multiple NodeJs version

nvm uninstall 8.11.1

Switching the NodeJs version

Get a List of installed NodeJs version

nvm list  //for windows

nvm ls //for MacOs/linux

nvm list

Switching Between installed NodeJs Versions

nvm use 8.11.1  //To enable 8.11.1

nvm use 12.13.1 //To enable 12.13.1

nvm use

Use Custom alias for installed NodeJs versions

We can create an alias as per the Project basis or the group of projects using the same NodeJs version.

nvm alias awesome-project 12.13.1

After creating an alias, then switch to the alias

nvm use awesome-project

Remove the Alias

nvm unalias awesome-project

Run to specific NodeJs version, without switching

nvm run 8.11.1 app.js

or can be used below command

nvm exec 8.11.1 node app.js

Other Commands

To use installed nodeJs version in the system

nvm use system

To completely remove nvm from the system.

nvm unload 

Conclusion

Node Version Manager (NVM) is a great tool and easy to switch between multiple node versions while working on projects that required different NodeJs versions. It saves a lot of development time by just switching to the version of nodejs needed.


LoginRadius Docs

Implement Authentication in Minutes

click here

Most Popular Tags

EngineeringJavaScriptNodeJsReactCSSSecurityAuthenticationOAuthGoSocialLogin

Are your customers safe on your application?

According to Forbes, data breaches exposed 4.1 billion records in the first six months of 2019. If this gets you worried, we’ve got your back!

LoginRadius protects your customers’ identities. We provide world-class security for your customers during login, registration, password setup, and any other data touchpoints, and make sure that their data is safe. We do so through by offering open source SDKs, integrations with over 150 third party applications, pre-designed and customizable login interfaces, and best-in-class data security products such as MFA, RBA, and Advanced Password Policies. The platform is already loved by over 3,000 businesses with a monthly reach of 1.17 billion users worldwide.Secure Your Application Now

Mayank Agarwal

Mayank Agarwal

Mayank is a Software developer at LoginRadius. He graduated with a Bachelor of Technology Degree in Computer Science. He loves to play cricket, watching TV series and listening music.

View Profile

Try a Modern Authentication Solution

$0/ month

Free Sign Up
  • 7,000 Monthly Active Users
  • 1 Web or Mobile App
  • Email/Password Login
  • 3 Social Login Providers
  • User Data Storage
  • Transactional Email Template
  • Customizable Login Interfaces