NPM 安装失败,出现 502 错误

NPM install failing with 502 error

这是一个比较晦涩的问题。我有一个 Angular 应用程序,它将通过 CI 的 Codeship 运行ning。但是,当 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

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

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

如我所料,我收到了 502 错误。然而,当我 运行 从我机器上的终端执行相同的命令时,我得到了相同的结果,即使 npm install 运行 对我来说是完美的。我找不到其他人遇到此类问题,502 似乎是 NPM 注册表返回的非常罕见的代码。有什么想法吗?

我通过 npm install on Ubuntu 14 运行 on AWS

看到了同样的问题
curl https://registry.npmjs.org/combine-lists/-/combine-lists-1.0.0.tgz

returns 来自 ubuntu 服务器的 502 错误网关,但从本地客户端可以正常工作

NPM 有一个未解决的问题:

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

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

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

NPM 刚刚承认了这个问题,他们正在努力解决这个问题。您可以在下方 link.

跟踪状态

http://status.npmjs.org

我在 npm 上发布包时遇到此错误。在用头撞墙几个小时后,我意识到我正在使用移动热点。我切换到 wifi,砰的一声,npm 上有我的包裹!

尝试在 .npmrc 文件中保留一个注册表,但只有一个有效。 注册表的顺序也很重要。也尝试设置:

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

清除终端内的代理。