使用:
节点v4.6.2,npm 2.15.5,nvm 0.29.0,Homebrew 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
字段都会在名称和网址之间发生变化,如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世界,我不明白这背后的逻辑。每次运行时,为什么npm-shrinkwrap会在URL和名称之间发生变化?在我看来,这使npm-shrinkwrap.json
对版本控制不可行。
如何使npm-shrinkwrap
保持一致且仅使用网址或名称?