See all package versions in npm cli


At work, I ran into an issue that may have been related to an external dependency. I wanted to update the package to see if a future release fixed the issue.

To get the latest version of a package, you can use the @latest tag:

npm i package-name@latest

But what if you need the next most recent release? Or five versions ago? I wanted to see a list of published versions without having to leave the command line.

A quick search led me to Viewing All Versions of an NPM Package (Including Pre-Release) by Will Anderson. He pointed to the npm view[1] command and illustrated how to use it:

npm view package-name versions

This will print all of the published versions of any package on the registry. Pretty handy!

Anderson mentions that this was undocumented in 2015, but today we have a page dedicated to the view command on npm.


Footnotes

  1. Anderson used the alias npm show ↩︎

Psalm 34:8 (SDG)

About

My name is Sean McPherson (SeanMcP), and I am a software engineer based in Pittsburgh, PA. Here I write articles about programming for developers of all levels.