Skip to content
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

[BUG] Can't upgrade npm when using symbolic links #639

Closed
aravindvnair99 opened this issue Dec 27, 2019 · 4 comments
Closed

[BUG] Can't upgrade npm when using symbolic links #639

aravindvnair99 opened this issue Dec 27, 2019 · 4 comments
Labels
Bug thing that needs fixing

Comments

@aravindvnair99
Copy link

Referred from nodejs/node#31111

  • Version: Version independent
  • Platform: Windows 10 x64

nodejs/node#30904 breaks dynamic links when using nvm.

npm install -g npm outputs:

C:\Program Files\nodejs\npx -> C:\Program Files\nodejs\node_modules\npm\bin\npx-cli.js
npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path C:\Program Files\nodejs\npm
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, open 'C:\Program Files\nodejs\npm'
npm ERR! [OperationalError: EPERM: operation not permitted, open 'C:\Program Files\nodejs\npm'] {
npm ERR! cause: [Error: EPERM: operation not permitted, open 'C:\Program Files\nodejs\npm'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'open',
npm ERR! path: 'C:\Program Files\nodejs\npm'
npm ERR! },
npm ERR! stack: "Error: EPERM: operation not permitted, open 'C:\Program Files\nodejs\npm'",
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'open',
npm ERR! path: 'C:\Program Files\nodejs\npm'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

After which, npm outputs:

bash: /c/Program Files/nodejs/npm: No such file or directory

And npm.exe has vanished:

image

Related:

npm/bin-links#12
npm/gentle-fs#7
320ac9a

@aravindvnair99
Copy link
Author

I reinstalled Node.js v12.11.1 with npm v6.11.3 Here's output for npm update -g on CMD, Git Bash and Powershell for both admin and non-admin modes:

Either this:

npm ERR! code EEXIST
npm ERR! path C:\Program Files\nodejs\npx.cmd
npm ERR! Refusing to delete C:\Program Files\nodejs\npx.cmd: is outside C:\Program Files\nodejs\node_modules\npm and not a link
npm ERR! File exists: C:\Program Files\nodejs\npx.cmd
npm ERR! Move it away, and try again.

Or this:

npm ERR! code EEXIST
npm ERR! path C:\Program Files\nodejs\npm.cmd
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.

@isaacs
Copy link
Contributor

isaacs commented Jan 2, 2020

What happens when you move the file aside and try again? Eg, rename C:\Program Files\nodejs\npm.cmd to C:\Program Files\nodejs\moved_npm.cmd and run moved_npm install npm -g

@aravindvnair99
Copy link
Author

What happens when you move the file aside and try again? Eg, rename C:\Program Files\nodejs\npm.cmd to C:\Program Files\nodejs\moved_npm.cmd and run moved_npm install npm -g

@isaacs coreybutler/nvm-windows#300 (comment) is what I have been doing for almost a year now. That works fine. But I'm still wondering why I am unable to update directly. It works fine when I'm using the official MSI, but not when using NVM4W. So, I thought it's something to do with the symlinks.

My Node.js and npm works fine, just that npm update -g or npm i -g npm throws me the errors stated above. I have also tried it on a fresh install of Windows, Node.js and npm.

@darcyclarke darcyclarke added the Bug thing that needs fixing label Oct 30, 2020
@darcyclarke
Copy link
Contributor

npm v6 is no longer in active development; We will continue to push security releases to v6 at our team's discretion as-per our Support Policy.

If your bug is preproducible on v7, please re-file this issue using our new issue template.

If your issue was a feature request, please consider opening a new RRFC or RFC. If your issue was a question or other idea that was not CLI-specific, consider opening a discussion on our feedback repo

Closing: This is an automated message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing
Projects
None yet
Development

No branches or pull requests

3 participants