Looks like npm-check-updates is the only way to make this happen now.
(看起来npm-check-updates是现在做到这一点的唯一方法。)
npm i -g npm-check-updates
ncu -u
npm install
On npm <3.11:
(在npm <3.11上:)
Simply change every dependency's version to *
, then run npm update --save
.
(只需将每个依赖项的版本更改为*
,然后运行npm update --save
。)
( Note: broken in recent (3.11) versions of npm ). (( 注意: 在最新(3.11)版本的npm中已损坏 )。)
Before:
(之前:)
"dependencies": {
"express": "*",
"mongodb": "*",
"underscore": "*",
"rjs": "*",
"jade": "*",
"async": "*"
}
After:
(后:)
"dependencies": {
"express": "~3.2.0",
"mongodb": "~1.2.14",
"underscore": "~1.4.4",
"rjs": "~2.10.0",
"jade": "~0.29.0",
"async": "~0.2.7"
}
Of course, this is the blunt hammer of updating dependencies.
(当然,这是更新依赖项的钝器。)
It's fine if—as you said—the project is empty and nothing can break. (如您所说,如果项目为空且没有任何中断,那就很好。)
On the other hand, if you're working in a more mature project, you probably want to verify that there are no breaking changes in your dependencies before upgrading.
(另一方面,如果您在一个更成熟的项目中工作,则可能要在升级之前验证依赖项中是否没有重大更改。)
To see which modules are outdated, just run npm outdated
.
(要查看哪些模块已过时,只需运行npm outdated
。)
It will list any installed dependencies that have newer versions available. (它将列出具有较新版本的所有已安装依赖项。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…