如何将package.json中的每个依赖关系更新为最新版本?

我的梦境 提交于 2020-08-06 04:31:18

问题:

I copied package.json from another project and now want to bump all of the dependencies to their latest versions since this is a fresh project and I don't mind fixing something if it breaks. 我从另一个项目复制了package.json,现在想将所有依赖项都升级到最新版本,因为这是一个新项目,如果出现问题,我不介意进行修复。

What's the easiest way to do this? 最简单的方法是什么?

The best way I know of now is to run npm info express version then update package.json manually for each one. 我现在所知道的最好方法是运行npm info express version然后为每个npm info express version手动更新package.json。 There must be a better way. 肯定有更好的办法。

{
  "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"
  }
}

UPDATE 5/1/19 : Six years later and I am still maintaining npm-check-updates as a comprehensive solution to this problem. 19年5月1日更新 :六年后,我仍在维护npm-check-updates作为该问题的综合解决方案。 Enjoy! 请享用!


解决方案:

参考一: https://stackoom.com/question/15RTf/如何将package-json中的每个依赖关系更新为最新版本
参考二: https://oldbug.net/q/15RTf/How-do-I-update-each-dependency-in-package-json-to-the-latest-version
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!