How to identify the latest npm package version
You can use
npm_info_cmd.sh
npm info [package name] version | head -n1to print just the latest package version, for example:
npm_info_example.sh
npm info @angular/cli version | head -n1The head -n1 part is neccessary to suppress unwanted npm info messages. Just running the command without head -n1 :
npm_info_full.sh
npm info @angular/cli versionprints the following output:
npm_info_output.txt
12.2.6
npm notice
npm notice New minor version of npm available! 7.21.1 -> 7.24.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v7.24.0
npm notice Run npm install -g [email protected] to update!
npm noticeI typically use the node:latest docker container instead of a local npm to find the latest version of an npm package:
docker_npm_command.sh
docker run -it --rm node:latest npm info meshcommander version | head -n1At the time of writing this article, the command prints
npm_version_output.txt
0.9.0-dCheck out similar posts by category:
NodeJS
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow