Skip to content

[BUG] npm update -g ds removes all global packages and npm itself #7731

Description

@ealexandrohin

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingPriority 2secondary priority issueplatform:windowsis Windows-specific

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions