How do I use npm to show the latest version of a module? I am expecting something like npm --latest express
to print out v3.0.0
.

- 3,522
- 6
- 25
- 40

- 8,770
- 8
- 44
- 64
-
check a package's semantic version [semver.npmjs.com](https://semver.npmjs.com) – tinystone Jul 28 '22 at 13:16
8 Answers
You can use:
npm view {pkg} version
(so npm view express version
will return now 3.0.0rc3
).
-
68`npm view`, `npm show`, `npm info`, and `npm v` all do the same thing. – Evan Hahn May 26 '14 at 08:36
-
6this way involves loads poking around to find latest version, npm outdated seems to be the best way – demee May 19 '16 at 13:55
-
1
-
4ah npm show {pkg} versions. version can be plural which will show all versions. – skyfoot Apr 07 '17 at 09:11
-
1If only there was a way to check the versions of multiple packages like this in one bulk request to the registry. Is there? – Eugene Kuzmenko Oct 01 '20 at 12:02
If you're looking for the current and the latest versions of all your installed packages, you can also use:
npm outdated

- 13,685
- 7
- 45
- 46
-
1I've looked at the whole post at least 5 times when I need to get the latest version of packages and I had never seen this, but it seems easier than running a number of other commands to check if you have libraries out of date – Ruan Mendes Oct 07 '16 at 13:18
-
2to learn what the columns mean: http://stackoverflow.com/questions/32689865/npm-wanted-vs-latest – adamdport May 09 '17 at 14:11
-
2a nice video explains how `outdated` and `update` work from NPM https://docs.npmjs.com/getting-started/updating-local-packages – XY L Sep 10 '18 at 05:21
-
THIS IS THE MOST USEFUL! I wish `npm update` would just run this too - so I can at least see the latest versions. When you only run these commands once a month or so it's hard to remember all the options. – Simon_Weaver Apr 03 '19 at 01:38
-
Except never mind - no it isn't. It shows me a completely blank column for latest, where I know some things have newer major versions :-/ – Simon_Weaver Apr 03 '19 at 01:40
-
Given how many users have found this answer helpful. Would it make sense to append this answer to the selected one? – mrOak Nov 01 '21 at 23:03
-
this *seems* to just show outdated packages in a project, how to show outdated globally installed packages? – user1063287 Dec 01 '21 at 04:25
As of October 2014:
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

- 35,523
- 17
- 121
- 125
-
3
-
1`npm view
versions` command is very useful. + we can install a specific version of a package using `npm install – efkan Dec 19 '14 at 12:20@ ` -
1The last command, it's such an ugly and a challenging thing to remember. I wonder why they have not come up with a shorthand for that? for the local version or same as the other two, but with a `-L` (lowercase optional)? – Val Feb 29 '16 at 11:59
You can see all the version of a module with npm view
.
eg: To list all versions of bootstrap including beta.
npm view bootstrap versions
But if the version list is very big it will truncate. An --json
option will print all version including beta versions as well.
npm view bootstrap versions --json
If you want to list only the stable versions not the beta then use singular version
npm view bootstrap@* versions
Or
npm view bootstrap@* versions --json
And, if you want to see only latest version then here you go.
npm view bootstrap version

- 7,071
- 16
- 58
- 85

- 869
- 8
- 11
The npm view <pkg> version
prints the last version by release date. That might very well be an hotfix release for a older stable branch at times.
The solution is to list all versions and fetch the last one by version number
$ npm view <pkg> versions --json | jq -r '.[-1]'
Or with awk instead of jq:
$ npm view <pkg> versions --json | awk '/"$/{print gensub("[ \"]", "", "G")}'

- 815
- 1
- 11
- 23
-
1I was in this exact case, and this answer was the most helpful to me! Thank you so much! Btw, you have a typo in the second example, you are missing the word `versions` before `--json` – slax57 Sep 19 '22 at 08:05
There is also another easy way to check the latest version without going to NPM if you are using VS Code.
In package.json file check for the module you want to know the latest version. Remove the current version already present there and do CTRL + space or CMD + space(mac).The VS code will show the latest versions

- 642
- 1
- 15
- 22
-
This does not work currently with the latest version of vscode. – Achyut Rastogi Sep 23 '21 at 19:04
-
@AchyutRastogi I am not sure why its not working for you. Its working fine in my VSCode – Sksaif Uddin Oct 13 '21 at 11:00
This npm-check-updates
package will help you to update and check the latest available package.
$ ncu
Checking package.json$ ncu -u
Update all packages.$ ncu -g
Check global packages.
For more details check this link

- 2,629
- 2
- 21
- 16
I just want to see the commithub current version and I find the way! Let's take a look together
npm list commithub version -g
This gives this output
/Users/hasan.tezcan/.nvm/versions/node/v14.18.0/lib
└── commithub@0.0.1
But I just want to see the version in output
npm list --depth=0 commithub -g | awk '/commithub@/{gsub(/.*@/, "", $NF); print $NF}'
After that I can able to see only version that is amazing
0.0.1

- 1,116
- 1
- 11
- 23