如何识别最新的 npm 包版本
你可以使用
npm_info_cmd.sh
npm info [package name] version | head -n1只打印最新的包版本,例如:
npm_info_example.sh
npm info @angular/cli version | head -n1head -n1 部分是必要的,用于抑制不需要的 npm info 消息。只运行不带 head -n1 的命令:
npm_info_full.sh
npm info @angular/cli version打印以下输出:
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 npm@7.24.0 to update!
npm notice我通常使用 node:latest docker 容器而不是本地 npm 来查找 npm 包的最新版本:
docker_npm_command.sh
docker run -it --rm node:latest npm info meshcommander version | head -n1撰写本文时,该命令打印
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