-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updating npm? #66
Comments
This appears to be a bug in npm v5. I can reproduce it without Earlier versions of npm (< 5.x) didn't have this problem. |
\cc @iarna |
It's still happening on nvs with Node 10+ and npm 6+. |
This does not reproduce on all Windows systems (for instance, mine, because of course not, that would be too easy). I do not believe the linked issues are in any way related. (They're error messages from the same validation function, but the details are actually quite a bit different.) This error is produced when the updated npm is trying to replace an existing npm.cmd, but the existing npm.cmd points at an source code location other than the one npm is installed to. This is typically caused by conflicting system paths and npm configs. I'm not familiar with nvs, but I would try To diagnose this in npm, we'd need: The output of: The contents the referenced And finally, the |
Thanks @iarna! I'll try and get that info. Update: Using Update: In the fail case of Node v8.11.3:
The contents of
Update: Getting the
Update: It looks like |
I meant the I had entirely forgotten that Node ships its own npm wrapper, one that's different than the one that npm itself creates and THAT is probably the heart of the problem here. Good news: I think I may be able to finally fix this (and also setup reproducers)! Bad news: The fix will only help if you're already running the newer version of npm. Inbetween news: I'm thinking about ways we might be able to work around that though. Like making newer versions of npm not let npm itself install its binaries and instead do them in a |
It is reproducible. It happens when the following are true:
The stock Windows Node.js install is supposed to include with it an The one shipped with npm on my machine is here: |
I just tried it, but it fails with the same Would a fix be back-portable to npm 5 so that a patch could land in a Node 8 patch-release? |
Sorry for the confusion, I meant The plan is that Node 8 will be getting npm 6, very soon, so it shouldn't be necessary to backport. But if need be, certainly. |
Oh rad!
Awesome! |
👋 Just wanted to check-in and see what the status of this was? |
Still the same: travis-ci/travis-ci#10245 |
So it seems the only solution is to switch to Yarn for now. |
@DanielRuf you don’t ever need to do that :-) the current solution is to detect windows, run |
@ljharb So |
Yes, with a bunch of logic to handle that you can’t alwsys jump from stock to latest in every node version. |
Actually this particular problem ("refusing to delete" the npm executable) seems to be a Windows-only issue. And I don't see anything that looks like a workaround for this in The issue of potentially having to hop between multiple versions to get to the latest is unrelated. I'm still investigating. I'll try to figure out some kind of fix/workaround for this problem on Windows. |
Fair; nvm only supports windows on WSL which doesn’t seem to have this problem. Note that the difficulty isn’t just having to hop around, it’s also knowing where to stop. |
The root cause appears to be that the
However, if you manage to install some version of
If I install a fresh Node.js version, then replace the @iarna Does this make sense to you? I can look into having |
I've implemented a workaround in |
Fixed in Note the fix gets applied during |
Thank you @jasongin! It works great! |
I noticed that nvs errors when attempting to update npm for a given version of node
errors with:
Is there a recommended way to update npm with nvs?
This is in AppVeyor where I specify a couple node versions like
node/8
.The text was updated successfully, but these errors were encountered: