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] npm uninstall doesn't work in 7.7.0 #2927

Closed
G-Rath opened this issue Mar 23, 2021 · 6 comments · Fixed by #2930
Closed

[BUG] npm uninstall doesn't work in 7.7.0 #2927

G-Rath opened this issue Mar 23, 2021 · 6 comments · Fixed by #2930
Labels
Bug thing that needs fixing Priority 0 will get attention right away Release 7.x work is associated with a specific npm 7 release

Comments

@G-Rath
Copy link
Contributor

G-Rath commented Mar 23, 2021

Current Behavior:

npm uninstall <package> doesn't do anything when using v7.7.0

Expected Behavior:

That the package I specify is uninstalled :)

Steps To Reproduce:

  1. npm i -g npm@7.7.0
  2. npm init -y
  3. npm install luxon
  4. npm uninstall luxon
Users/G-Rath/te is 📦 v1.0.0 took 2s
❯ npm un luxon

up to date, audited 1 package in 234ms

found 0 vulnerabilities

If you replace step 1. with npm i -g npm@7.6.0, it all works as expected:

Users/G-Rath/te is 📦 v1.0.0 took 6s
❯ npm un luxon

removed 1 package, and audited 1 package in 2s

found 0 vulnerabilities

Environment:

OS: Ubuntu 18.04 via WSLv1
Node: 14.6.0
npm: 7.7.0

@G-Rath G-Rath added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Mar 23, 2021
@erunion
Copy link

erunion commented Mar 23, 2021

Also seeing this on npm remove.

$ npm remove react
npm ERR! code EACCES
npm ERR! syscall open
npm ERR! path /usr/local/package-lock.json
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, open '/usr/local/package-lock.json'
npm ERR!  [Error: EACCES: permission denied, open '/usr/local/package-lock.json'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'open',
npm ERR!   path: '/usr/local/package-lock.json'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
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.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jon/.npm/_logs/2021-03-23T21_03_16_479Z-debug.log

I do not see this on 7.6.3.

@G-Rath
Copy link
Contributor Author

G-Rath commented Mar 23, 2021

@erunion that looks like a different issue to me, specifically thats an EACCES error; mine is just outputting "up to date" so its not even trying to do anything.

(I'll update my issue to reflect that)

@erunion
Copy link

erunion commented Mar 23, 2021

👍 I'll open up a new ticket.

@jameschensmith
Copy link
Contributor

I am also facing this error. I was looking into this to see if my changes to arborist in v7.7.0 affected this. Fortunately, it didn't 😅 It appears to be due to this commit this commit, which is removing references to flatOptions in favor of a more unified config.

By reverting this commit, removal works again. But, we should figure out the reason why this isn't working 😋 So, it has to do with the return value of this.npm.config.get('prefix'). On my machine, it's returning the default value of prefix in npm config, which appears to be the Node.js installation directory (this is also npm prefix -g). From the previous flatOptions, this returned undefined, which it then passed to arborist. I believe both of these are incorrect, because when I run npm prefix in an npm project directory, I tend to get my current directory 😊

Next step would be checking to see why this.npm.config.get('prefix') is not returning the current directory.

@jameschensmith
Copy link
Contributor

As a temporary workaround, you could possibly do this (below is POSIX-compliant shell):

PREFIX=$(pwd) npm rm [<@scope>/]<pkg>...

I was able to uninstall a package using the above, but YMMV.

@ruyadorno ruyadorno added Priority 0 will get attention right away and removed Needs Triage needs review for next steps labels Mar 24, 2021
@ruyadorno
Copy link
Contributor

fixed in npm@7.7.1 thanks @jameschensmith for the quick patch! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Priority 0 will get attention right away Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants