dannymcgee
dannymcgee

Reputation: 673

Updating node.js with NVM for Windows

I've been using NVM for Windows to run two versions of Node on my system, the latest version and the LTS version. However, I haven't updated Node since installing NVM. I would like to update both versions to their current iterations (11.5.0 and 10.14.2 at the time of writing), ideally without having to reinstall all of my global packages for each. I know the original NVM has this capability with the --reinstall-packages-from flag, but it doesn't look like there's anything similar in NVM for Windows.

Upvotes: 4

Views: 1683

Answers (2)

Gal Margalit
Gal Margalit

Reputation: 5844

It's unsupported by design
https://github.com/coreybutler/nvm-windows/issues/236

NVM4W provides a more minimalistic approach, focusing on node version management, not npm management. NVM4W leaves workflow customization to the end user... because a) it's not hard, and b) it's very opinionated.

The statement "switching node version needs reinstallation of all packages in most cases" is unsubstantiated. This doesn't mean it's not true, but there aren't any stats to back this claim. There are plenty of use cases where this is not the case, such as developing original modules with forward/backwards compatibility.

Third, automating this process, either forcibly or by default, has a number of unintended consequences in a Windows environment. See the Roaming Profiles use case for an example.

Even if this were a non-default optional command, it still strays from node version management into npm management. This is an entirely different problem (and a much bigger problem).

Upvotes: 0

Elliot Nelson
Elliot Nelson

Reputation: 11557

You're right, there's nothing similar in NVM for Windows. If it would be useful for you, you could always request it by opening an issue on the github page.

It sounds like you already know how to install 11.5.0 and 10.14.2, and that once you do, running nvm use 11 or nvm use 10 will automatically select the latest appropriate version (but you'll still have to manually reinstall any global packages).

This might be an opportunity to take stock of global packages, they often cause more trouble than they are worth. (In general, the fewer global packages installed the better.)

Upvotes: 2

Related Questions