Skip to content

[BUG] npm update --global fails: npm ERR! global requires an add or rm option #1962

@felipecrs

Description

@felipecrs

Current Behavior:

$ npm install --global [email protected]

changed 1 package, and audited 1 package in 2s

found 0 vulnerabilities

$ npm update --global
npm ERR! global requires an add or rm option

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/felipesantos/.npm/_logs/2020-10-14T13_14_27_261Z-debug.log

$ npm update --global semver
npm ERR! global requires an add or rm option

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/felipesantos/.npm/_logs/2020-10-14T13_17_01_600Z-debug.log

$ cat /home/felipesantos/.npm/_logs/2020-10-14T13_14_27_261Z-debug.log
0 verbose cli [
0 verbose cli   '/home/felipesantos/.nvm/versions/node/v12.19.0/bin/node',
0 verbose cli   '/home/felipesantos/.nvm/versions/node/v12.19.0/bin/npm',
0 verbose cli   'update',
0 verbose cli   '--global'
0 verbose cli ]
1 info using [email protected]
2 info using [email protected]
3 timing config:load:defaults Completed in 1ms
4 timing config:load:file:/home/felipesantos/.nvm/versions/node/v12.19.0/lib/node_modules/npm/npmrc Completed in 1ms
5 timing config:load:builtin Completed in 1ms
6 timing config:load:cli Completed in 2ms
7 timing config:load:env Completed in 0ms
8 timing config:load:file:/mnt/c/Users/felip/.npmrc Completed in 1ms
9 timing config:load:project Completed in 3ms
10 timing config:load:file:/home/felipesantos/.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:/home/felipesantos/.nvm/versions/node/v12.19.0/etc/npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:cafile Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:setUserAgent Completed in 1ms
17 timing config:load:setEnvs Completed in 0ms
18 timing config:load Completed in 8ms
19 verbose npm-session 38aa94d0b0d83ff4
20 timing npm:load Completed in 14ms
21 timing arborist:ctor Completed in 0ms
22 timing command:update Completed in 2ms
23 verbose stack Error: global requires an add or rm option
23 verbose stack     at Arborist.buildIdealTree (/home/felipesantos/.nvm/versions/node/v12.19.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/build-ideal-tree.js:185:29)
23 verbose stack     at Arborist.[loadTrees] (/home/felipesantos/.nvm/versions/node/v12.19.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:186:17)
23 verbose stack     at Arborist.reify (/home/felipesantos/.nvm/versions/node/v12.19.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:121:27)
23 verbose stack     at update (/home/felipesantos/.nvm/versions/node/v12.19.0/lib/node_modules/npm/lib/update.js:34:13)
23 verbose stack     at cmd (/home/felipesantos/.nvm/versions/node/v12.19.0/lib/node_modules/npm/lib/update.js:15:27)
23 verbose stack     at Object.[_runCmd] (/home/felipesantos/.nvm/versions/node/v12.19.0/lib/node_modules/npm/lib/npm.js:112:7)
23 verbose stack     at fn (/home/felipesantos/.nvm/versions/node/v12.19.0/lib/node_modules/npm/lib/npm.js:46:40)
23 verbose stack     at Object.<anonymous> (/home/felipesantos/.nvm/versions/node/v12.19.0/lib/node_modules/npm/lib/cli.js:56:7)
24 verbose cwd /mnt/c/Users/felip
25 verbose Linux 4.19.104-microsoft-standard
26 verbose argv "/home/felipesantos/.nvm/versions/node/v12.19.0/bin/node" "/home/felipesantos/.nvm/versions/node/v12.19.0/bin/npm" "update" "--global"
27 verbose node v12.19.0
28 verbose npm  v7.0.0
29 error global requires an add or rm option
30 verbose exit 1

Expected Behavior:

Before v7.0.0, running npm update --global would update all the packages installed globally which are outdated.

Steps To Reproduce:

Install an outdated global package, and try to update all the packages.

Environment:

  • OS: Ubuntu 20.04.1
  • Node: 12.19.0
  • npm: 7.0.0

Metadata

Metadata

Assignees

Labels

Bugthing that needs fixingRelease 7.xwork is associated with a specific npm 7 release

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions