-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
Current Behaviour:
I have some npm packages installed globally, which are command line utilities (create-react-app, distributed-dig, snyk`, and others). I recently updated to npm version 7 (7.5.2) with node 14 (14.15.4) on Windows 10 (version: 2004 || build: 19041.746).
If I perform a global dedupe ...
npm dedupe -g... a number of the globally installed packages are removed. Curiously not all of them. In the example below eight of the 11 are removed.
Incidentally, I couldn't reproduce this behaviour with npm v7.5.2 & node v15.5.1 on Linux Mint v19
Expected Behaviour:
I'd expect the same behaviour as npm v6 where each top-level globally installed package persists after the global dedupe. In the example steps below I'd expect all 11 globally installed packages to still be installed after the dedupe.
Steps To Reproduce:
Report current versions: npm -v ; node -v
PS C:\Users> npm -v;node -v
7.5.2
v14.15.4List currently installed global packages (and report a count): npm ls -g --depth 0;npm ls -g --depth 0|find "--" /c
PS C:\Users> npm ls -g --depth 0;npm ls -g --depth 0|find `"--`" /c
C:\Users\markm\AppData\Roaming\npm
+-- akamai-error-lookup@1.2.8
+-- akamai-staging@1.1.8
+-- ascii-art@2.5.0
+-- cdn-cache-check@1.6.0
+-- codename-generator@1.0.15
+-- create-react-app@4.0.2
+-- depcheck@1.3.1
+-- distributed-dig@1.8.3
+-- eslint@7.19.0
+-- jshint@2.12.0
+-- npm@7.5.2
`-- snyk@1.441.0
12Perform a global dedupe: npm dedupe -g
PS C:\Users> npm dedupe -g
added 1 package, removed 1334 packages, and audited 256 packages in 6s
11 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilitiesNotice that removed 1334 packages
Re-list globally installed packages (and a new count): npm ls -g --depth 0;npm ls -g --depth 0|find "--" /c
PS C:\Users> npm ls -g --depth 0;npm ls -g --depth 0|find `"--`" /c
C:\Users\markm\AppData\Roaming\npm
+-- acorn-jsx@5.3.1
+-- npm@7.5.2
`-- prettyjson@1.2.1
3Eight of the the initial 11 global packages are now removed

