DIEA
2019-07-05 16:21:35
如何將Package.json中的每個(gè)依賴項(xiàng)更新為最新版本?我從另一個(gè)項(xiàng)目中復(fù)制了Package.json,現(xiàn)在我想將所有的依賴項(xiàng)都添加到它們的最新版本,因?yàn)檫@是一個(gè)新的項(xiàng)目,如果它壞了,我不介意修復(fù)它。做這件事最簡單的方法是什么?我現(xiàn)在所知道的最好的方法就是跑npm info express version然后手動(dòng)更新Package.json。一定有更好的辦法。{
"name": "myproject",
"description": "my node project",
"version": "1.0.0",
"engines": {
"node": "0.8.4",
"npm": "1.1.65"
},
"private": true,
"dependencies": {
"express": "~3.0.3", // how do I get these bumped to latest?
"mongodb": "~1.2.5",
"underscore": "~1.4.2",
"rjs": "~2.9.0",
"jade": "~0.27.2",
"async": "~0.1.22"
}}更新5/1/19六年后,我仍然堅(jiān)持NPM-檢查更新作為這個(gè)問題的綜合解決方案。好好享受吧!
3 回答

米脂
TA貢獻(xiàn)1836條經(jīng)驗(yàn) 獲得超3個(gè)贊
npm i -g npm-check-updates ncu -u npm install
*
npm update --save
. (注:
"dependencies": { "express": "*", "mongodb": "*", "underscore": "*", "rjs": "*", "jade": "*", "async": "*" }
"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" }
npm outdated
添加回答
舉報(bào)
0/150
提交
取消