NPM安装失败,出现502错误

问题描述 投票:5回答:4

这是一个相当模糊的问题。我有一个Angular应用程序将通过Codeship for CI运行。但是,当需要在Codeship框中运行npm install时,npm会回复

-npm ERR! fetch failed https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-2.4.1.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 502
\npm ERR! fetch failed https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-2.4.1.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 502
\npm ERR! fetch failed https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-2.4.1.tgz
npm ERR! Linux 4.2.0-38-generic
npm ERR! argv "/home/rof/.nvm/versions/node/v4.1.1/bin/node" "/home/rof/.nvm/versions/node/v4.1.1/bin/npm" "install"
npm ERR! node v4.1.1
npm ERR! npm  v2.14.4

npm ERR! fetch failed with status code 502

这很奇怪,因为npm install在我的盒子上工作得很好。我的第一直觉是它必须是NPM存储库的一个问题,所以我抓住了包的URL(https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-2.4.1.tgz)并将其扔进了新的Chrome选项卡。果然,档案几乎立即下载了。我对此感到困惑,所以我再次尝试了Codeship构建,但得到了相同的结果。我决定通过SSH进入Codeship框,看看我是否可以访问它。我跑了

curl https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-2.4.1.tgz

正如我所料,我得到了502错误。但是,当我从我的机器上的终端运行相同的命令时,我得到了相同的结果,即使npm install完全适合我。我无法找到其他人遇到此类问题,而502似乎是一个非常罕见的NPM注册表返回代码。有任何想法吗?

node.js curl npm codeship
4个回答
7
投票

这是某些地区的registry.npmjs.org的问题。

这是问题:https://github.com/npm/npm/issues/13284


3
投票

我在AWS上运行的Ubuntu 14上通过npm install看到了同样的问题

curl https://registry.npmjs.org/combine-lists/-/combine-lists-1.0.0.tgz

从ubuntu服务器返回502 Bad Gateway,但从本地客户端可以正常工作

NPM有一个未解决的问题:

https://github.com/npm/npm/issues/13284


2
投票

NPM刚刚承认了这个问题,他们正在努力解决这个问题。您可以在以下链接中跟踪状态。

http://status.npmjs.org


0
投票

我在npm上发布我的包时遇到了这个错误。将我的头撞在墙上几个小时之后,我意识到我正在使用移动设备。我切换到wifi并且敲响了我的包裹在npm!


0
投票

尝试在.npmrc文件中保留一个注册表,其中只有一个可以正常工作。注册表的顺序也很重要。还尝试设置:

  • npm config delete proxy
  • npm config delete https-proxy

清理终端内的代理。

© www.soinside.com 2019 - 2024. All rights reserved.