npm - how to show the latest version of a package

Solution 1:

You can use:

npm show {pkg} version

(so npm show express version will return now 3.0.0rc3).

Solution 2:

If you're looking for the current and the latest versions of all your installed packages, you can also use:

npm outdated

Solution 3:

As of October 2014:

npm view illustration

For latest remote version:

npm view <module_name> version  

Note, version is singular.

If you'd like to see all available (remote) versions, then do:

npm view <module_name> versions

Note, versions is plural. This will give you the full listing of versions to choose from.

To get the version you actually have locally you could use:

npm list --depth=0 | grep <module_name>

Note, even with package.json declaring your versions, the installed version might actually differ slightly - for instance if tilda was used in the version declaration

Should work across NPM versions 1.3.x, 1.4.x, 2.x and 3.x