0

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 n@6.1.0
$ npm install -g eslint@6.7.0
$ npm install -g generator-wombytes-cpp@0.2.0

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.

Thomas Sablik
  • 16,127
  • 7
  • 34
  • 62
  • `eslint`'s latest version `6.8.0` is a [MAJOR](https://semver.org/) update from `5.16.0`, i.e. it has incompatible API changes with the current version - hence the message. Whilst `jshint`'s latest `2.11.0` is a MINOR update from `2.10.2`, i.e. it has added functionality in a backwards compatible manner. Presumably you get a similar message when running `npm update -g n` ? – RobC Feb 21 '20 at 15:33
  • @RobC I added some information to my question. As you can see `npm` would update some packages but wouldn't update one other package. Why? And why doesn't it behave as documented? Is it a bug? – Thomas Sablik Feb 21 '20 at 15:44
  • See related issues [#746](https://github.com/npm/cli/issues/746) and [#755](https://github.com/npm/cli/pull/755) - whether it's a bug or incorrect documentation is yet to be determined. IMHO it's the latter (incorrect docs). After the edit you made, i.e. installing specific versions to check if related to minor/major versions, presumably when you next run e.g. `npm update -g ` for each one it updates them all to the version listed in the _Latest_ column because there is no `MAJOR` diffs between _Current_ and _Latest_ unlike your previous examples? – RobC Feb 21 '20 at 16:14

0 Answers0