使用:
节点v4.6.2,NPM 2.15.5,NVM 0.29.0,Homebrew 1.1.1.1.1-64-G17BAD9A,MACOS 10.12.1
步骤:
- 我更新
package.json
, - 删除我所有的模块:
rm -fr node_modules
, - 重新安装所有内容:
nvm exec npm install
, - 并更新收缩夹:
nvm exec npm shrinkwrap --dev
。
结果:
每次,每个模块的from
字段都会在名称和URL之间发生变化,如npm-shrinkwrap.json
diff的部分捕获中所示:
diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json
index e1f679a..476febe 100644
--- a/npm-shrinkwrap.json
+++ b/npm-shrinkwrap.json
@@ -4,86 +4,86 @@
"dependencies": {
"active-model-adapter": {
"version": "2.1.1",
- "from": "active-model-adapter@2.1.1",
+ "from": "https://registry.npmjs.org/active-model-adapter/-/active-model-adapter-2.1.1.tgz",
"resolved": "https://registry.npmjs.org/active-model-adapter/-/active-model-adapter-2.1.1.tgz"
},
"bootstrap-daterangepicker": {
"version": "2.1.21",
- "from": "bootstrap-daterangepicker@2.1.21",
+ "from": "https://registry.npmjs.org/bootstrap-daterangepicker/-/bootstrap-daterangepicker-2.1.21.tgz",
"resolved": "https://registry.npmjs.org/bootstrap-daterangepicker/-/bootstrap-daterangepicker-2.1.21.tgz",
"dependencies": {
"jquery": {
"version": "3.1.1",
- "from": "jquery@>=1.10.0",
+ "from": "https://registry.npmjs.org/jquery/-/jquery-3.1.1.tgz",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-3.1.1.tgz"
}
}
},
"bower": {
"version": "1.8.0",
- "from": "bower@1.8.0",
+ "from": "https://registry.npmjs.org/bower/-/bower-1.8.0.tgz",
"resolved": "https://registry.npmjs.org/bower/-/bower-1.8.0.tgz"
},
"broccoli-asset-rev": {
"version": "2.5.0",
- "from": "broccoli-asset-rev@>=2.2.0 <3.0.0",
+ "from": "https://registry.npmjs.org/broccoli-asset-rev/-/broccoli-asset-rev-2.5.0.tgz",
"resolved": "https://registry.npmjs.org/broccoli-asset-rev/-/broccoli-asset-rev-2.5.0.tgz",
"dependencies": {
"broccoli-asset-rewrite": {
"version": "1.1.0",
- "from": "broccoli-asset-rewrite@>=1.1.0 <2.0.0",
+ "from": "https://registry.npmjs.org/broccoli-asset-rewrite/-/broccoli-asset-rewrite-1.1.0.tgz",
"resolved": "https://registry.npmjs.org/broccoli-asset-rewrite/-/broccoli-asset-rewrite-1.1.0.tgz"
来自邦德勒(Bundler)的红宝石世界(Ruby World),我不明白这背后的逻辑。为什么NPM-ShrinkWrap每次运行时都应该在URL和名称之间更改?我认为,这使得npm-shrinkwrap.json
是版本控制的不切实际。
如何使npm-shrinkwrap
保持一致,仅使用URL或名称?
这更多地是关于如何使用NPM安装软件包。您可以在此处阅读说明