Closed
Description
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
Running npm -g update serverless@pre-3
wipes the content of the global node_modules directory (/usr/local/lib/node_modules
).
Here is a log file of the command: https://gist.github.com/mnapoli/0170614e3f4ab1915a82783bf871d033
Here is what I tried to pinpoint the problem:
- no problem with a local install (
npm update serverless@pre-3
) npm -g i pure-prompt
worksnpm -g update pure-prompt
worksnpm -g i serverless
worksnpm -g update serverless
worksnpm -g i serverless@pre-3
worksnpm -g update serverless@pre-3
❌ wipes everythingyarn global add serverless
worksyarn global update serverless@pre-3
works
Expected Behavior
Nothing should be removed, the package should be installed.
Steps To Reproduce
Run:
npm -g update serverless@pre-3
Now all global dependencies are gone (e.g. serverless
, npm
, etc.). The global folder /usr/local/lib/node_modules
still exists, but it's empty.
I have to reinstall NPM and reinstall all global NPM dependencies.
Environment
- npm: 8.3.0
- Node.js: v17.3.1
- OS Name: macOS
- System Model Name: Bug Sur 11.6.2
- npm config:
; "builtin" config from /usr/local/lib/node_modules/npm/npmrc
prefix = "/usr/local"
; "user" config from /Users/matthieu/.npmrc
//npm.pkg.github.com/:_authToken = (protected)
//registry.npmjs.org/:_authToken = (protected)
; node bin location = /usr/local/Cellar/node/17.3.1/bin/node
; cwd = /Users/matthieu/dev/PHP/bref
; HOME = /Users/matthieu
; Run `npm config ls -l` to show all defaults.