-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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 update --global fails: npm ERR! global requires an add or rm option #1962
Comments
Can confirm this happens for me too ...
|
Same error if I just want to update global packages:
Or
Seeing it with v7.0.1 on Windows and Debian 10. These worked for 6.x |
seems to be fixed in v7.0.2 |
I'm still seeing the same issue with 7.0.2 $ npm -v $ npm -g update |
I can confirm the same behavior in npm 7.0.3 on Windows 10 x64. Just upgraded from npm@6 and got this surprise. |
npm v 7.0.2 on macOS nodejs v15 has same problem. npm ERR! global requires an add or rm option |
Same issue for me. MacOS, npm v7.0.3. Using nvm. |
Same. On MacOS, with Brew. I After that, I I then ran |
I did the same as @WraithKenny, but with the difference that I |
Because npm 7 isn’t “latest”, you don’t want to use |
I encountered this problem today on Win 10 after updating node to version 15.0.1 and concomitantly npm to version 7.0.5. A quick look at the files in the debug log stack trace points to the following lines (184-5) in file npm\node_modules\npm\node_modules@npmcli\arborist\lib\arborist\build-ideal-tree.js:
This is my first delve into the underlying code and it isn't clear to me from the context around these lines what their intended purpose is but they clearly put a hard stop to any global update actions other than add or rm. |
|
@WraithKenny @alaadahmed You both probably have two global node_modules directories now, right?
and
And calling |
@ErikAbele Yes I found out this later. |
Aye, seeing the same here on OSX :-( I got it all sorted on my Ubuntu 20.04 box but as soon as I try to update npm to 7.0.5 on OSX it switches my global node_modules directory to Ubuntu 20.04:
MacOS X:
And as soon as I do a |
OK I did the following and it solved the problem of newly created path for global packages: 1- I think for ubuntu you need to make update: it still doesn't work with npm@7 .. but works with npm@6 and |
Excellent, this finally did the trick – thank you! (Weird, |
@ErikAbele OK now which version of npm you have?! And if |
I had [email protected] (which came with the fresh install of [email protected]), then I added the prefix and updated to [email protected] via
|
I guess as long as 7.0.5 is not marked as being latest (and instead 6.14.8 is) we will have to live with that... :-/ |
I rollback to |
Good morning at all. I have the same problem. If I do "npm upadate -g" it give me "global requires an add or rm option" and if I do "npm list -g" it give me '[email protected]'. If I downgrade to npm 6, the problem persists. My real problem is that I had many packages installed globally and I don't remember all. There is a way to recover them? I'm on macOS Mojave. |
You can read this and it will solve your issue: #1962 (comment) |
I’m running into all of the issues on this thread 😞 . . . downgrading back to |
Is an official fix being worked on yet? Right now I can't update my global packages without re-installing them. |
Does this still happen on v7.0.7? |
NPM v7.0.8 is out and the bug still exists. Please, do something about it. |
Potential Work Around, Mac: |
What's the output of |
@felipecrs it's going to depend on the version installed using n.
@felipecrs it's going to depend on the version installed using n. |
Try npm v7.0.8? |
Issue persists :-( |
This issue is back again with today's homebrew upgrade |
Just to sort this out, it's an issue with npm v7 no matter what node version (such as 15). |
Can confirm this issue persists... Have we heard of a fix being worked on? Just got a new work computer last week and have not had any luck :( |
@felipecrs et al: yes, you're right, it is an issue with just npm@7 – I just tried with latest 7.0.8 and the issue persists. |
I completely removed Node and npm module folder in my %USERAPPDATA%.
Conclusion: |
Doesn't look like v7.0.9 is going to fix the issue either. |
The bug has been acknowledged and a fix is scheduled for an upcoming release. |
Thank you for looking into this, @isaacs! |
This adjusts the portion of the global actualTree that gets loaded when doing an update, and sets up the virtual global package manifest to depend on '*' for all the packages being updated at the top global level. Fixes: npm/cli#1962
* prevent self-assignment of parent/fsParent * Support update options in global package space Fix: #1962
Thanks a lot for fixing this. When do you expect the next update to release with this fix? |
I updated to version 7.5.4 with |
Current Behavior:
Expected Behavior:
Before v7.0.0, running
npm update --global
would update all the packages installed globally which are outdated.Steps To Reproduce:
Install an outdated global package, and try to update all the packages.
Environment:
The text was updated successfully, but these errors were encountered: