[BUG] Downgrading to previous npm version deletes all global packages. #3671
Labels
Bug
thing that needs fixing
Needs Triage
needs review for next steps
Release 7.x
work is associated with a specific npm 7 release
Is there an existing issue for this?
Current Behavior
Downgrading npm 7.21.0 to a previous 7.x version causes all global packages to be deleted.
Expected Behavior
Downgrading npm 7.21.0 to a previous 7.x version should not delete all global packages.
Steps To Reproduce
A. Installed a clean node 14.17.5 installation (https://nodejs.org/dist/v14.17.5/node-v14.17.5-win-x64.zip) on Windows 10 in c:\temp\node. To avoid side-effects :
B. Then in a DOS shell:
Until now OK.
C. Then I wanted to upgrade npm to the latest version (7.21.0):
Because npm update -g npm@latest does nothing and npm install -g npm@latest fails with "File exists: c:\temp\node\npm.cmd", I used following procedure to upgrade to npm@latest (based on https://try2explore.com/questions/10972799):
Until now OK.
D. Now I wanted to downgrade npm to [email protected]:
Result :
c:\temp\node\node_modules now completely empty! Also if I first would have installed other global packages (verdaccio, yeoman, ...), then they would also have disappeared from c:\temp\node\node_modules.
Above procedure was performed in a DOS shell but I also encountered the same issue in a Powershell 7 shell.
Environment
The text was updated successfully, but these errors were encountered: