How does `npm outdated -g` actually work?

991 Views Asked by At

I have some globally installed packages and I want to update some of them. I checked with

$ npm outdated -g
Package                 Current  Wanted  Latest  Location
eslint                   5.16.0  5.16.0   6.8.0  global
jshint                   2.10.2  2.11.0  2.11.0  global
n                        2.1.12  2.1.12   6.2.0  global
npx                      10.2.0  10.2.2  10.2.2  global

I tried

$ npm update -g eslint --dd

but I got the message

outdated not updating eslint because it's currently at the maximum version that matches its specified semver range

I checked the documentation with

$ npm help outdated
  • wanted is the maximum version of the package that satisfies the semver range specified in package.json. If there's no available semver range (i.e. you're running npm outdated --global, or the package isn't included in package.json), then wanted shows the currently-installed version.

But that's obviously not true because

$ npm update -g jshint

worked and the values of Current and Wanted for the package jshint were different before the update. How is the value of wanted actually defined?

Sidequestion: What is the npm-way to update all outdated packages and what is the npm-way to update one package?

EDIT:

To check if it's related to major and minor version numbers I installed

$ npm install -g [email protected]
$ npm install -g [email protected]
$ npm install -g [email protected]

and I updated the other packages. Now the output is

$ npm outdated -g
Package                 Current  Wanted  Latest  Location
eslint                    6.7.0   6.8.0   6.8.0  global
generator-wombytes-cpp    0.2.0   0.2.0   0.3.0  global
n                         6.1.0   6.2.0   6.2.0  global

There is a different behavior for these packages.

0

There are 0 best solutions below