Instead of installing the latest version of an NPM package using
npm install x@latest
is there a way to view the latest stable version? something like this:
npm view x@stable version
I am looking for a programmatic/command line solution.
Instead of installing the latest version of an NPM package using
npm install x@latest
is there a way to view the latest stable version? something like this:
npm view x@stable version
I am looking for a programmatic/command line solution.
Utilizing the following syntax returns the semver/value of the latest stable version only:
You'll need to replace the
<name>
part with the actual package name.Example:
Running the command above currently prints
6.26.0
to the console, whilst the latest non-stable version available is the npm registry is currently7.0.0-beta.3
Notes:
The command above will report the same version which would get installed when running:
Caveat: For either of the two commands to get the truly stable latest version they are reliant on the author/owner of the package having correctly managed their dist-tags. An excerpt from the docs (at the link provided) reads: