Tom
Tom

Reputation: 8681

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.

Upvotes: 69

Views: 93099

Answers (5)

khoi nguyen
khoi nguyen

Reputation: 666

At the time of my answer, we have Volta that can install, switch, pin (remember version based on projects) between node, npm and yarn. Super awesome!

Upvotes: 0

Kritarth Sharma
Kritarth Sharma

Reputation: 432

For context, I needed to run different node versions across different terminals on windows, and found that nvm-windows does not support it because of the way it works as per Gabriel's answer on top.

Found this wonderful work on github - https://github.com/davfive/nvm-session and all credits to the creator, for building a simple workaround for this. The steps to get this working are clearly explained in the README of the repository, and helped me solve my problem!

However, I believe it requires you to use git-bash/any such bash-supported terminals on windows to get this working!

Upvotes: 0

harp
harp

Reputation: 109

I set my node version default like this: nvm alias default <version>

Upvotes: 1

Sukhpreet Singh
Sukhpreet Singh

Reputation: 641

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.

Upvotes: 52

Ian Paschal
Ian Paschal

Reputation: 823

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.

Upvotes: 55

Related Questions