https://blog.csdn.net/u011240877/article/details/76582670 这篇写的比较详细,还有版本的问题如下
然后关于这两个文件,如果没有packag-lock.json,执行npm i的时候会自动生成这个文件,所有依赖包为当前package.json里所允许的最新版本。
当有lock.json文件的时候,再npm i,只会装lock.json里所规定的锁定版本,但依赖包的依赖包依然会自动更新,即会更新lock.json文件,但大版本是不会变的。
例子及字段解释
"@hui-pro/empty": {
"version": "1.1.0",
"resolved": "http://...",
"integrity": "sha1-D2egR6O4AeJh31PAr0KIyJJsciQ=",
"requires": {
"@hui-pro/locale": "^1.1.0",
"@hui-pro/theme": "^1.1.0",
"@hui-pro/utils": "^1.1.0"
},
"dependencies": {
"@hui-pro/locale": {
"version": "1.1.0",
"resolved": "http://...",
"integrity": "sha1-ZzHcgwh/q5CqslQadrXzhzQc7vQ=",
"requires": {
"deepmerge": "^1.5.2"
}
},
"@hui-pro/theme": {
"version": "1.1.0",
"resolved": "http://...",
"integrity": "sha1-+buQbn8OnWU32dIdNg6v9g6cUrU=",
"requires": {
"sass": "^1.19.0",
"sass-loader": "^7.1.0"
}
},
"@hui-pro/utils": {
"version": "1.1.0",
"resolved": "http://...",
"integrity": "sha1-V862xMe+H5G751C3CpT3bGIFr1k=",
"requires": {
"h-jsencrypt": "^1.0.1",
"moment": "^2.24.0",
"qs": "^6.5.2",
"resize-observer-polyfill": "^1.5.1"
}
}
}
}
version:应安装的特定版本;
resolved:模块的位置(URI);
integrity:验证模块完整性的哈希;
requires:它依赖的包列表;
dependencies:依赖包详情列表;