json - 使用 `npm update`时如何更新package.json中的所有包版本号?

标签 json node.js npm nodes

当我使用 npm update 时,我可以更新所有包,但 package.json 中的包版本号没有改变,在 package.json 中,有 devDependenciesdependencies ,像这样:

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "jquery": "^1.11.2"
  },
  "devDependencies": {
    "lodash": "^2.4.1"
  }
}

如何使用一行命令更新 devDependencies 中的所有包和所有包编号,dependencies 也会更新。

最佳答案

一个简单的步骤:

$ npm i -g npm-check-updates && ncu -a && npm i

就是这样。 package.json 中的所有包版本都将是最新的。

关于json - 使用 `npm update`时如何更新package.json中的所有包版本号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41740788/

相关文章:

javascript - ThreeJS 中的对象未使用 JSONLoader 加载 : Cannot read property 'visible' of undefined

node.js - 更改 "IBM Watson Visual Recognition service custom classifier"中的阈值

node.js - AWS dynamodb 端点不正确

javascript - 使用 npm 离线引导 Web 应用程序

javascript - JS 结果集转 JSON

javascript - Gruntfile 中止文件

javascript - Visual Studio 2017 : js file causes many typescript errors

npm 9 不会复制本地依赖项的 js 文件

java - org.json.JSONException : JSONObject ["ListeCar"] not found

linux - mongod(v2.6.5) 分片集群查询延迟问题?