1

使用:

节点 v4.6.2、npm 2.15.5、nvm 0.29.0、自制 1.1.1-64-g17bad9a、macOS 10.12.1

脚步:

  • 我更新package.json
  • 删除我所有的模块:rm -fr node_modules
  • 重新安装一切:nvm exec npm install
  • 并更新收缩包装:nvm exec npm shrinkwrap --dev

结果:

每次,每个模块的字段都会在名称和 URL 之间变化,如下图difffrom的部分捕获所示:npm-shrinkwrap.json

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保持一致并且只使用 URL 或名称?

4

1 回答 1

1

更多的是关于如何使用 npm 安装软件包以及何时安装。你可以在这里阅读解释

于 2017-06-22T15:30:20.037 回答