【问题标题】:npm shrinkwrap contains paths to localhostnpm shrinkwrap 包含到 localhost 的路径
【发布时间】:2016-12-01 23:19:44
【问题描述】:

运行npm shrinkwrap后发现我们有很多对localhost的引用:

  egrep localhost npm-shrinkwrap.json 
  "resolved": "http://localhost:4873/constants-browserify/-/constants-browserify-0.0.1.tgz"
  "resolved": "http://localhost:4873/https-browserify/-/https-browserify-0.0.0.tgz"
  "resolved": "http://localhost:4873/path-browserify/-/path-browserify-0.0.0.tgz"
  "resolved": "http://localhost:4873/pbkdf2-compat/-/pbkdf2-compat-2.0.1.tgz"
  "resolved": "http://localhost:4873/ripemd160/-/ripemd160-0.2.0.tgz"
  "resolved": "http://localhost:4873/sha.js/-/sha.js-2.2.6.tgz"
  "resolved": "http://localhost:4873/shimmer/-/shimmer-1.1.0.tgz"
  "resolved": "http://localhost:4873/tty-browserify/-/tty-browserify-0.0.0.tgz"
  "resolved": "http://localhost:4873/utils-merge/-/utils-merge-1.0.0.tgz"
  "resolved": "http://localhost:4873/vm-browserify/-/vm-browserify-0.0.4.tgz"

原来这些引用也在原始 node_modules 中:

egrep 'localhost:4873' node_modules/ -r 
node_modules/path-browserify/package.json:  "_resolved": "http://localhost:4873/path-browserify/-/path-browserify-0.0.0.tgz",
node_modules/utils-merge/package.json:  "_resolved": "http://localhost:4873/utils-merge/-/utils-merge-1.0.0.tgz",
node_modules/ripemd160/package.json:  "_resolved": "http://localhost:4873/ripemd160/-/ripemd160-0.2.0.tgz",
node_modules/constants-browserify/package.json:  "_resolved": "http://localhost:4873/constants-browserify/-/constants-browserify-0.0.1.tgz",
node_modules/tty-browserify/package.json:  "_resolved": "http://localhost:4873/tty-browserify/-/tty-browserify-0.0.0.tgz",
node_modules/vm-browserify/package.json:  "_resolved": "http://localhost:4873/vm-browserify/-/vm-browserify-0.0.4.tgz",
node_modules/shimmer/package.json:  "_resolved": "http://localhost:4873/shimmer/-/shimmer-1.1.0.tgz",
node_modules/https-browserify/package.json:  "_resolved": "http://localhost:4873/https-browserify/-/https-browserify-0.0.0.tgz",
node_modules/pbkdf2-compat/package.json:  "_resolved": "http://localhost:4873/pbkdf2-compat/-/pbkdf2-compat-2.0.1.tgz",
node_modules/sha.js/package.json:  "_resolved": "http://localhost:4873/sha.js/-/sha.js-2.2.6.tgz",

所以这意味着我在安装时遇到了很多获取和重试错误:

npm ERR! fetch failed http://localhost:4873/constants-browserify/-/constants-browserify-0.0.1.tgz
npm WARN retry will retry, error on last attempt: Error: connect ECONNREFUSED 127.0.0.1:4873
npm ERR! fetch failed http://localhost:4873/https-browserify/-/https-browserify-0.0.0.tgz
npm WARN retry will retry, error on last attempt: Error: connect ECONNREFUSED 127.0.0.1:4873
...

这不可能。解决此问题的最佳方法是什么?

【问题讨论】:

  • 你在运行本地 npm 服务器吗?
  • 看起来你正在运行npmjs.com/package/sinopia
  • 没有本地服务器...同样npm get registry返回https://registry.npmjs.org/所以它不指向本地主机...
  • 没有本地服务器运行:telnet localhost 4873 Trying 127.0.0.1... telnet: Unable to connect to remote host: Connection refused
  • 您可能在第一次安装软件包时已经运行了它。

标签: npm shrinkwrap npm-shrinkwrap


【解决方案1】:

我遇到了类似的问题。我经常在注册表之间切换。解决方案是在安装/收缩包装之前运行npm cache clear

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-12-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-03
    • 1970-01-01
    • 2016-05-28
    • 2014-12-29
    相关资源
    最近更新 更多