[BUG] npm update -g package@latest
removes all global packages #3175
Closed
Description
Current Behavior:
Attempting to update a package with a tag using the update
command globally causes ALL global packages to be removed.
Expected Behavior:
Packages should not be removed when updating global packages.
Steps To Reproduce:
npm i -g typescript nodemon @angular/cli # Install some global packages
npm ls -g --depth=0 # This shows the 3 installed packages
npm update -g @angular/cli@latest # Attempt to update one of the packages with a @latest tag
# Oh no! removed 620 packages
npm ls -g --depth=0 # Shows `-- (empty)
Environment:
- OS: Windows 10 20H2
- Node: 15.9.0
- npm: 7.11.2
Additional Info
This only happens on the global scope