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 update -g ds removes all global packages and npm itself #7731

Open
2 tasks done
eAlexandrohin opened this issue Aug 18, 2024 · 3 comments
Open
2 tasks done
Labels
Bug thing that needs fixing Priority 2 secondary priority issue

Comments

@eAlexandrohin
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

Title. Basically self-destructs and purges all global packages and you can't even run npm after.
As I have tested, it works with any package that is not installed, even non-existent ones.

npm update -g [non-installed package]

To fix it, you need to re-install whole Node again with nvm.

Expected Behavior

Don't self-destruct and delete all global packages, when you specify package that is not installed.

Steps To Reproduce

  1. run npm update -g ds
  2. get the result
removed 203 packages in 641ms
The batch file cannot be found.
  1. try to run npm again npm -v
'npm' is not recognized as an internal or external command,
operable program or batch file.
  1. become aware of your unimportance to the universe

Environment

  • npm: probably was 10.8.2, but I cannot check it because npm itself doesn't exist anymore.
  • Node.js: 22.6.0 (64-bit) via nvm
  • OS Name: Windows 10
  • npm config: cannot give you, as stated above.
@eAlexandrohin eAlexandrohin added Bug thing that needs fixing Needs Triage needs review for next steps labels Aug 18, 2024
@ljharb
Copy link
Contributor

ljharb commented Aug 18, 2024

npm update should never be run with -g.

@eAlexandrohin
Copy link
Author

npm update should never be run with -g.

but how you should update your global packages then?

@ljharb
Copy link
Contributor

ljharb commented Aug 29, 2024

One at a time, manually, with npm install. (also you probably shouldn't have any global packages)

@milaninfy milaninfy added Priority 2 secondary priority issue and removed Needs Triage needs review for next steps labels Sep 13, 2024
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 2 secondary priority issue
Projects
None yet
Development

No branches or pull requests

3 participants