Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I use npm to install some command line tools. Having the itch to always be up to date, I found the command npm -g outdated.

What is the difference between the columns wanted and latest?

The documentation states:

The resulting field 'wanted' shows the latest version according to the version specified in the package.json, the field 'latest' the very latest version of the package.

However I don't find it clear at all. For example on my system I get:

Package  Current  Wanted  Latest  Location
cordova    5.3.1   5.3.3   5.3.1  lib
npm        3.3.4   3.3.4   3.3.3  lib

How can wanted be higher than latest? It seems to contradict:

the field 'latest' the very latest version of the package

Which version should I update to (I only use the command-line, not any node.js code)?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
440 views
Welcome To Ask or Share your Answers For Others

1 Answer

The wanted field makes no sense in the context of a --global run as there is no package.json to define which version you require.

Which version should I update to (I only use the command-line, not any node.js code)?

The latest version seems as a good choice if you like to live on the edge.

The wanted column seems like a bug, it is reported in github many times.

Update (after checking source)

The documentations seems a bit misleading so lets clarify:

The resulting field 'wanted' shows the latest version according to the version specified in the package.json...

As there is no global package.json, the version constrain used is '*' (set here).

Then the wanted version is the latest version of the package according to semver.

the field 'latest' the very latest version of the package.

Thats not true, what you get is the dist-tag "latest", that usually matches the latest version (see here). There are some packages that uses those tags to manage what get shown (like npm).

Which version should I update to (I only use the command-line, not any node.js code)?

It seems that the edge is wanted.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...