-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Cannot update npm (node 8.4.0) #300
Comments
Same problem here. |
I had the same issue, and here is how I got through : run To remove the files you can use this shortcut: my env: |
Seeing same problem |
same |
@kuncevic |
So much for production. Good luck doing in a script. |
They should rename continuous integration to continuous intebreaktion |
@19majkel94 Couldn't get it working with your method... any other ideas which I could script? |
It appears as though npm has changed how it updates itself... without telling anyone. npx was also introduced with only a minor version change (as opposed to a major change).... which is semantically correct, but still hard to follow along. Apparently there is some file sandboxing happening. I spent the better part of today investigating and attempting a fix, but each fix surfaces another issue. Bear with me, I'll get it fixed as soon as I can. I'm the only one working on this at the moment... and I happen to be in the middle of a different product launch (after 2yrs of work), so a PR would gladly be accepted. |
I wish I could help, but I have an observation... I think that the issues are related to the shortcut to " https://docs.microsoft.com/en-us/sysinternals/downloads/junction |
BTW, using a junction should future proof nvm4w against any future changes to npm's behavior. |
@wayne-oscme
|
@19majkel94 Being a redirect to the target directory, which as we see is where processes end up, can lead to some interesting issues. Junctions are the equivalent of hard links in *nix. Windows only supports these to directories, and not to files, but that's all we need here. They are not redirects. They are, for all intents and purposes, the directory, no different than the path created when the directory was first created. They don't redirect, they are the destination. They can be deleted and created again with each 'use' command. Therefore, they will have the same effects and capabilities as shortcuts, but none of the downfalls that are creating the current problem. |
This has nothing to do with junctions/hard links/symlinks. @kuncevic provided a screenshot citing npm errors, the key part being This didn't seem to be an issue until npm 5.x.x, and I'm still digging through the details to figure out what has changed. I may have to write a workaround (i.e. hack), which I'm never fond of. I'm also looking into utilizing the msi packages, which seems to be the only way to get the attention of the folks at npm. If you're in dire need of updating npm, you can download it via
|
Okay, I guess I should try before selling. I replaced the shortcut with a
junction, and got the same exact issue. Thought I had something there.
Sorry to waste your time.
…On Wed, Sep 27, 2017 at 9:38 AM, Corey Butler ***@***.***> wrote:
This has nothing to do with junctions/hard links/symlinks. @kuncevic
<https://github.com/kuncevic> provided a screenshot citing npm errors,
the key part being Refusing to delete ... which is outside of ..... That
is a hard-coded message in npm, preventing further operations. Bottom line:
npm is refusing to full update itself.
This didn't seem to be an issue until npm 5.x.x, and I'm still digging
through the details to figure out what has changed. I may have to write a
workaround (i.e. hack), which I'm never fond of. I'm also looking into
utilizing the msi packages, which seems to be the only way to get the
attention of the folks at npm.
If you're in dire need of updating npm, you can download it via
https://github.com/npm/npm/archive/vX.X.X.zip and extract it into the
node_modules directory of your node installation root. You'll need to
manually create a symlink in the *node installation root* to npm.cmd and
npx.cmd. The final file structure should look something like:
nvm
- v8.5.0
- node_modules
- npm
- bin
- npm.cmd
- npx.cmd
...
- node.exe
- npm.cmd (symlink to v8.5.0/node_modules/npm/bin/npm.cmd)
- npx.cmd (symlink to v8.5.0/node_modules/npm/bin/npx.cmd)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#300 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEZgRbY_GVys0bfnD_kaM_PYl6QUmZKDks5smk_PgaJpZM4PPcf->
.
|
Just updated
|
@kuncevic - thanks... that's indicative the problem must be within npm 5.4.3+. |
npm -g install [email protected] still fails for me, same errors.
[Edit] BTW, that's starting from 5.3.0, which was installed with nvm install 8.5.0
…On Fri, Sep 29, 2017 at 11:41 AM, Corey Butler ***@***.***> wrote:
@kuncevic <https://github.com/kuncevic> - thanks... that's indicative the
problem must be within npm 5.4.3+.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#300 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AEZgRQnw_jxuz_dDZl3OsZVO_MNkHlBGks5snQ-qgaJpZM4PPcf->
.
|
For me it fails from Node 8.4.0 and up. It installs NPM 5.3.0, and then won't allow me to upgrade it. |
Man. npm 5 and nvm really sucks big time (but I blame npm 5 here since 4 works perfectly fine). I've downgraded to npm 4.6.1 last week and just tried to give 5.4.2 another try. Looks like npm has been uninstalled while trying to install react-native-cli, a completely different package:
|
npm i -g npm@latest
/home/user/.npm-global/bin/npm -> /home/user/.npm-global/lib/node_modules/npm/bin/npm-cli.js
/home/user/.npm-global/bin/npx -> /home/user/.npm-global/lib/node_modules/npm/bin/npx-cli.js
+ [email protected]
added 68 packages, removed 164 packages and updated 14 packages in 14.307s
|
@yavorski - this is nvm for Windows. I think you want nvm for *nix. |
I have confirmed this issue is sandboxing within npm 5.x.x. Prior editions of npm did not have this. Unfortunately, the fix is non-trivial, and judging by @yavorski's experience, it's not specific to this project. |
Yep no nvm in my case. Linux + Nodejs from nodesource. |
Having same issue here... |
I just needed Step 4, i.e. Just download and fresh install Node JS. |
Reinstalling the node version works fine, but since this is an issue associated with nvm uninstall VERSION
nvm install VERSION After that, close and re-open the shell. Quick and easy (now that you know, at least). 😄 If you have any issues (e.g. EDIT: |
This script works perfect: #300 (comment) Thank you! |
This powershell script works perfect: #300 (comment) Thanks! |
@ganselmo If you're installing via the Control Panel, you're not using nvm. You need to uninstall that version before you even install nvm. |
This uses the npx executable script that you're trying to update, so it's likely to fail due to locking the file. |
I got this work by renaming |
Its been 3 years since this reply, but it still works! |
This was my fix: |
Feels kind of mean to offer another package as a solution... but this absolutely worked out of the box for me and I love Rust. Thanks for the info @alekslario |
I modified this answer for node 15.10.0 and npm 7.5.3 and it very helpful for me. I added one another step for renaming npx too
|
Another idea I've tried (I don't know if anyone has already mentioned it) is to install npm directly without using npm itself. Refer to npmjs in the “Direct Download” section, and it works. |
This works. To use:
|
That worked for me, at last. Thank you |
|
For me I only get the problem when updating npm from npm v6.
|
Hi guys, have also problem to report after Windows reinstall can't seam to get latest npm for nvm node version 6.12.0 which I need to use, tried nvm version 1.1.9 and 1.1.7, it keeps failing with:
Tried all methods above all lead to this issue. Tried to make this folders, but it starts adding packages and then folder disappears and get same error. Tried installing this promisify globally doesn't help, on version 14.18.3 I'm able to update npm with that method to rename npm folder and execute that npm script in bin folder but on this no. After I do npm install it totally nukes whole npm and you can't use command anymore it throw error as whole bin folder it gone. Tried separate 6.12.0 download from node, deleted nvm, it seams this is node issue, not nvm itself. Latest update, I managed to update with specific version like 5.7.1, as I needed min npm version 5 so I guess will go with that if anyone needs it. Command I used was:
|
Note that you need to enable Windows Developer Mode to allow Volta to set symlinks. Otherwise you get issues with access privileges similar to nvm. I have switched to Volta now but that might be helpful for nvm, too. |
Just delete the folder ...\AppData\Roaming\npm and \AppData\Roaming\npm-cache. |
I was trying to upgrade Using Looks like that from whatever version of |
Elevating user privileges to Administrator solved the issue for me. |
Usage:
Example:
Thank you
|
How come this 5 years old issue is still not fixed..? I believe original nvm has a special command for upgrading npm and it should be the case here too. Having to rely on some obscure .bat scripts found in comments is ridiculous... |
And finally, I uninstall nodejs and then re-install it. Then everything is ok! This is what I did:
|
Yes folks, volta is an option, as is nodist, fnm, nvs, etc. You're welcome to use those. I'm going to remove comments about other version managers though, because they don't help this project improve... and that's the point of the issues for this project. For anyone finding this issue from Google, please make sure you've read the instructions... specifically the ones about removing any prior versions of Node.js (https://github.com/coreybutler/nvm-windows/wiki/Common-Issues#uninstall-existing-node-installation-before-installing-nvm4w). It is possible to update npm, but you cannot have conflicts in your PATH, or permission restrictions... and there are a few older versions of npm with hardcoded pathing issues. When the v1.1.11 patch release drops, use the I still cannot replicate this problem and there has been a |
I asked CHATGPT and it suggested to upgrade npm with If you're using nvm-windows to manage your Node.js versions on Windows and you want to update npm to X version, you can follow these steps:
By following these steps, you should be able to update npm to the X version using nvm-windows on Windows. Follow this url to know which version of npm belongs to node |
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
Windows 7 or below (not truly supported due to EOL - see wiki for details)
Windows 8
Windows 8.1
Windows 10
Windows 10 IoT Core
Windows Server 2012
Windows Server 2012 R2
Windows Server 2016
My Windows installation is non-English.
I'm using NVM4W version:
I have already...
My issue is related to (check only those which apply):
Expected Behavior
npm i -g npm@latest should install latest npm version
Actual Behavior
an error:
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.
Steps to reproduce the problem:
run as an administrator
npm i -g npm@latest
The text was updated successfully, but these errors were encountered: