Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple versions of node on windows

I currently have the following versions installed my windows machine.

node : v7.3.0 npm : 3.10.10 @angular/cli : 1.4.2

I would like to install latest versions of the above and be able to switch accordingly. To my knowledge installation of node governs that. If I need to install latest npm and angular cli then i would need to install the latest version of node. Please do correct me if I am wrong. Can i globally install the latest version of nodejs. Once I install that could i switch between the node versions. I presume switching between the node versions would take care to use the appropriate npm and cli.

like image 718
Tom Avatar asked May 17 '18 19:05

Tom


People also ask

Can I have multiple node versions in Windows?

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).

How do I install multiple node versions in Windows?

Before installing the latest package, ensure that you cleanup your environment first: Uninstall existing Node instances and remove existing installation directories. Uninstall existing npm install location (e.g. “C:\Users<user>\AppData\Roaming\npm”) Download the latest version of nvm for Windows and install it.

Can I have more than one node version?

You have the latest and greatest version of Node. js installed, and the project you're about to work on requires an older version. In those situations, the Node Version Manager (nvm) is a great tool to use, allowing you to install multiple versions of Node. js and switch between them as you see fit.


2 Answers

This is achievable via various version managers.

For Windows, take a look at NVM for Windows.

For macOS or Linux (not your OS, I see, but for others reading), I like n, and NVM is also widely used.

like image 91
Ian Paschal Avatar answered Oct 26 '22 08:10

Ian Paschal


nvm-windows let's you do that. Before installing nvm-windows, please uninstall all Node versions from your computer.

To install any Node version, type in command prompt nvm install [node version], like for example:

  • nvm install 10.16.0
  • nvm install 6.11.0

nvm list lists all Node versions you installed:

  • 10.16.0
  • 6.11.0

nvm use 6.11.0

or

nvm use [version name]

and you will be prompted by a windows pop up to allow nvm-windows to use/switch to a particular Node version.

like image 42
Sukhpreet Singh Avatar answered Oct 26 '22 08:10

Sukhpreet Singh