Open eAlexandrohin opened 2 months ago
npm update should never be run with -g.
npm update should never be run with -g.
but how you should update your global packages then?
One at a time, manually, with npm install
. (also you probably shouldn't have any global packages)
Here's the log I saw, hopefully it helps others find this issue:
PS C:...> npm i -g tsc
npm ERR! code EEXIST
npm ERR! path C:\Users\admin\AppData\Roaming\npm\tsc
npm ERR! File exists: C:\Users\admin\AppData\Roaming\npm\tsc
npm ERR! with --force to overwrite files recklessly.
npm ERR! C:\Users\admin\AppData\Local\npm-cache\_logs\2024-10-14T15_28_08_921Z-debug.log
PS C:...> npm update -g tsc
removed 2019 packages, and audited 1 package in 8s
PS C:...> npm update -g tsc
npm error Class extends value undefined is not a constructor or null
For me, fixing it required uninstalling nvm before reinstalling node the proper way (perhaps reinstalling node through nvm would work too).
Is there an existing issue for this?
This issue exists in the latest npm version
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.
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
npm update -g ds
npm -v
Environment