nvm-windows
nvm-windows copied to clipboard
Upgrading existing node version vs separate install
If this is a question about how to use NVM4W, please use stackoverflow instead.
If this is an issue regarding antivirus, make sure you search the existing issues first.
My Environment
- [x] Windows 10
I'm using NVM4W version:
- [x] 1.1.5
I have already...
- [x] read the README to be aware of npm gotchas & antivirus issues.
- [x] reviewed the wiki to make sure my issue hasn't already been resolved.
- [x] verified I'm using an account with administrative privileges.
- [x] searched the issues (open and closed) to make sure this isn't a duplicate.
- [x] made sure this isn't a question about how to use NVM for Windows, since gitter is used for questions and comments.
My issue is related to (check only those which apply):
- [ ] settings.txt
- [ ] proxy support (Have you tried version 1.1.0+?)
- [ ] 32 or 64 bit support (Have you tried version 1.1.3+?)
- [ ] Character escaping (Have you tried version 1.1.6+?)
- [x] A standard shell environment (terminal/powershell)
- [ ] A non-standard shell environment (Cmder, Hyper, Cygwin, git)
Expected Behavior
nvm upgrade x.x.x
would replace the current version in use with the specified one.
For example, I have node 6.11.0 installed and it's currently the 'active' version. I've also upgraded npm and installed a couple of globals, like gulp.
I just want to update node 6.11.0 to 6.11.1, but I will have to reinstall all of the globals to do so.
Actual Behavior
nvm displays help text
Steps to reproduce the problem:
nvm upgrade 6.11.1
This is more of an environment management issue than a version management issue. There's a very low chance of this being added directly to the tool.
However; hooks are on the roadmap and a script launcher is under consideration. These would allow users to implement whatever actions they want. For example, a custom script like nvm run migrate --from=6.10.1 --to=6.11.1
could be created to do what you're interested in.
How is it more an issue of environment than version exactly? I don't even understand what that means.
This is probably the simplest issue of managing a version; literally going from 6.11.0 to 6.11.1 because nodejs.org says there's a necessary security update. Without nvm, this is very simple to manage; just install the update. With nvm, I have to reinstall every version of everything in the global npm space.
If you truly don't see this as a version management issue, please close.
Version management is the isolation of node installations and the process of switching the active version. Environment management is the process of tuning a specific installation.
If an upgrade feature is added, there will inevitably be a request for a downgrade feature. There have been tons of other requests for managing the environment from a multi-version standpoint, like sharing global modules across versions... but we haven't reached a consensus on this.
You can see everything in the discussions:
https://github.com/nodejs/version-management/issues/14 https://github.com/nodejs/version-management/issues/4 https://github.com/nodejs/version-management/blob/master/edge_cases.md
At the end of the day, I believe the core tool should remain very focused, yet extendable. Hooks and scripts will make it much more extendable... just like they do for git and npm. Once those features are available, I intend to write some scripts (like an upgrade) and maybe setup a shareable repo for people. I'm going to re-open this because I think your request is relevant, I just think it needs to be implemented in a different place.
I would like to be able to upgrade npm
(e.g. npm install -g npm@latest
) while using nvm
on windows in order to work around an npm
bug, but this doesn't currently seem possible. When I try (from elevated cmd.exe
) I get:
Microsoft Windows [Version 10.0.16299.64]
(c) 2017 Microsoft Corporation. All rights reserved.
C:\WINDOWS\system32>npm install -g npm@latest
npm ERR! path C:\Program Files\nodejs\npm.cmd
npm ERR! code EEXIST
npm ERR! Refusing to delete C:\Program Files\nodejs\npm.cmd: is outside C:\Program Files\nodejs\node_modules\npm and not a link
npm ERR! File exists: C:\Program Files\nodejs\npm.cmd
npm ERR! Move it away, and try again.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Jacob\AppData\Roaming\npm-cache\_logs\2017-12-04T23_09_14_149Z-debug.log
C:\WINDOWS\system32>```
Does this fall under the same issue or should is there a more appropriate place to discuss this?
@jacobq - that's a function of npm, not node.... so this is already possible. However; it is only possible in slightly older versions of node because npm broke itself and a number of things dependent on it (i.e. not just NVM4W). See https://github.com/coreybutler/nvm-windows/issues/319 for the conversation around this and a link to the upstream issue.
@coreybutler Thanks for your comment, but I think you misunderstand. I am just using 8.x/LTS at the moment. When I install it directly (not using nvm4w) I can run npm install -g [email protected]
to get npm v5.6. However, this does not work with nvm4w. How is that an upstream issue? It seems to have to do with the fact that nvm4w is managing links to the "real" npm, node, etc.
Hi, Any way in the end to easily upgrade a node version without having to care of reinstalling all global modules? If I can remember, the "shell script nvm tool" has an option to install the latest node version: it will install a new version, will copy over the global modules and delete current version. Sounds like a sensible option if you ask me. I think they also have an install option with the possibility to copy global modules from an existing version. Wouldn't this approach work fine without having to change much things?
The original nvm supports this via nvm install --reinstall-packages-from=<version>
, e.g. nvm install --lts --reinstall-packages-from=current
The original nvm supports this via
nvm install --reinstall-packages-from=<version>
, e.g.nvm install --lts --reinstall-packages-from=current
This is something I use when I need to upgrade in Linux/WSL. Now using NVM4W it's now cumbersome to do a simple upgrade with just a single line
I encountered this same issue and wrote a PowerShell script which helps with this. It makes a list of installed NPM and PNPM packages, installs a new version of node.js, switches to it, installs the list of packages, and optionally deletes the old node.js environment.