用 npm outdated 检查过期的依赖包

一条命令列出所有有新版本的依赖,并排显示当前版本、semver 允许的版本和最新版本。

Windows开发npm 包管理低风险
在项目文件夹运行 `npm outdated`,即可看到哪些包落后以及可升级到哪些版本。

01命令

命令
$ npm outdated

02作用说明

升级之前得先知道哪些包过期了、差多少。npm outdated 会为每个过期的包输出一行:Current 是已安装版本,Wanted 是你的 semver 范围允许的最新版本,Latest 是官方发布的最新版本。已达到 Wanted 的包不会出现,所以列出来的正好就是待升级清单——之后用 `npm update` 全部升到 Wanted,或用 `npm install 包名@latest` 有意识地跳到 Latest。

03风险

风险低风险
使用条件Requires Node.js/npm installed and a package.json in the current folder. Empty output means every package is current.
!注意: 直接跳到 Latest 可能引入破坏性的大版本变更;升级前看看更新日志,或者先稳妥地升到 Wanted。

04撤销

✓无需撤销——该命令不会改变持久状态。

05来源

  • npm-outdated (v9) | npm Docs
    npm, Inc. · vendor-doc · 2026-09-17
    依据: Documents the outdated check across dependencies and the wanted/latest columns.
  • npm-outdated | npm Docs
    npm, Inc. · vendor-doc · 2026-09-17
    依据: npm outdated lists installed packages that are out of date, showing current, wanted and latest versions.

最后验证: 2026-09-19 · 分类: 开发者

06相关方案