如何锁定依赖项的版本号

时间:2019-04-03 07:46:04

标签: node.js npm

我想锁定模块的依赖关系,我该怎么做?假设我有一个模块"uglifyjs-webpack-plugin": "^2.0.1",该模块使用uglify-js: ^3.0.0,并且uglify-js的版本已更新为3.1.1,但我想坚持使用同一版本3.0.0

参考:[NPM Lock down dependency versions in our dependencies package.json

我也尝试过npm收缩包装,但是当我更改版本并运行npm install时,npm-shrinkwrap.json文件将再次更新。

"uglifyjs-webpack-plugin": {
  "version": "2.0.1",
  "resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-2.0.1.tgz",
  "integrity": "sha512-1HhCHkOB6wRCcv7htcz1QRPVbWPEY074RP9vzt/X0LF4xXm9l4YGd0qja7z88abDixQlnVwBjXsTBs+Xsn/eeQ==",
  "dev": true,
  "requires": {
    "cacache": "^11.2.0",
    "find-cache-dir": "^2.0.0",
    "schema-utils": "^1.0.0",
    "serialize-javascript": "^1.4.0",
    "source-map": "^0.6.1",
    "uglify-js": "^3.0.0",
    "webpack-sources": "^1.1.0",
    "worker-farm": "^1.5.2"
  }
}

我想将uglify-js的版本锁定为〜3.0.0

0 个答案:

没有答案