赞
踩
{
"name": "test",
"version": "0.0.0",
"private": true,
"scripts": {
"clean": "test clean",
},
"dependencies": {
"express": "^4.17.1",
},
"devDependencies": {
"webpack": "^4.41.0"
}
}
比如express所依赖的子模块body-parser为^1.19.0,结果某一天开发body-parser模块的作者升级为了,1.30.23,但这个版本在当前项目环境无法编译通过,这时候又不能修改express版本,该怎么办呢?这时候可以使用package.json的resolutions,锁定express的子依赖版本号,修改后的结果如下
{ "name": "test", "version": "0.0.0", "private": true, "scripts": { "clean": "test clean", }, "dependencies": { "express": "^4.17.1", }, "devDependencies": { "webpack": "^4.41.0" }, "resolutions": { "body-parser": "1.19.0" } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。