node.js 为什么 npm 会给出 500 和 503 错误:“registry error parsing json”?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21122814/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 16:39:43  来源:igfitidea点击:

Why is npm giving 500 and 503 errors: "registry error parsing json"?

node.jsnpmsteroids

提问by alnafie

Trying to do npm install steroids -gand running into lots of errors of two types:

试图做npm install steroids -g并遇到两种类型的大量错误:

First: 500

第一:500

npm ERR! registry error parsing json
npm http 500 https://registry.npmjs.org/cardinal
npm ERR! registry error parsing json
npm http 500 https://registry.npmjs.org/glob
npm ERR! registry error parsing json
npm http 500 https://registry.npmjs.org/chmodr
npm ERR! registry error parsing json
npm http 500 https://registry.npmjs.org/fstream
npm ERR! registry error parsing json

when I visit those urls in the browser I get the following message:

当我在浏览器中访问这些 url 时,我收到以下消息:

Internal routing error

Sorry, we cannot connect to the intended server.

We have just been notified of this problem. We will correct it as soon as possible.

Feel free to contact us if you have any questions: [email protected]

内部路由错误

抱歉,我们无法连接到目标服务器。

我们刚刚被告知这个问题。我们会尽快改正。

如果您有任何问题,请随时与我们联系:[email protected]

Second: 503

第二:503

npm http 503 https://registry.npmjs.org/forever-agent
npm ERR! registry error parsing json
npm http 503 https://registry.npmjs.org/cheerio
npm ERR! registry error parsing json
npm http 503 https://registry.npmjs.org/request
npm ERR! registry error parsing json
npm http 503 https://registry.npmjs.org/diff
npm ERR! registry error parsing json
npm http 503 https://registry.npmjs.org/tar

When I visit those urls in the browser I get this message:

当我在浏览器中访问这些网址时,我收到以下消息:

Error 503 backend read error

backend read error

Guru Meditation:

XID: 1448084160

Varnish cache server

错误 503 后端读取错误

后端读取错误

上师冥想:

身:1448084160

优化缓存服务器

Does this mean the npm registry is down? or do I have strange behavior on my machine?

这是否意味着 npm 注册表已关闭?还是我的机器上有奇怪的行为?

Running node v.0.10.24 & npm v.1.3.21

运行节点 v.0.10.24 & npm v.1.3.21

回答by josketres

Try using a mirror for example the european mirror:

尝试使用镜子,例如欧洲镜子:

npm --registry http://registry.npmjs.eu/ install karma

回答by RaphaelDDL

From @npmjsaround 15mins after your question was made:

在您提出问题大约 15 分钟后,来自@npmjs

"aware of the outage. please be patient. working to resolve this now."

“知道停电了。请耐心等待。现在正在努力解决这个问题。”

On side note, read Node Roundup: Surviving npm Downtime, Waf Wall of Shame, stream-chat, Vein, interest info about NPM mirrors. Kinda outdated (2012) but now you know it has mirrors ;-)

另外,请阅读Node Roundup: Surviving npm Downtime、Waf Wall of Shame、流聊天、Vein、关于 NPM 镜像的兴趣信息。有点过时(2012)但现在你知道它有镜子;-)

Also, a good advice by 'mark' at the comments of this blogpost I linked:

此外,在我链接的这篇博文的评论中,“标记”给出了一个很好的建议:

If you're relying on NPM for production deployments, STOP! Make sure you set specific versions and clone them in your private repo. Deploy from your private repo not the NPM registry. You have been warned. Relying on NPM for production deployment scripts has bitten us twice! The first was because a library author deleted an old version of his library we depended on. This time it was the NPM registry itself.

如果您依赖 NPM 进行生产部署,请停止!确保您设置了特定版本并将它们克隆到您的私人仓库中。从您的私有仓库而不是 NPM 注册表进行部署。你被警告了。依赖 NPM 进行生产部署脚本已经让我们咬了两口!第一个是因为图书馆作者删除了我们所依赖的图书馆的旧版本。这次是 NPM 注册表本身。

回答by AxeEffect

npm has a status page where any server incidence will (should) be reflected:

npm 有一个状态页面,其中将(应该)反映任何服务器事件:

https://status.npmjs.org

https://status.npmjs.org