简体   繁体   English

npm 获取失败。 错误代码 504

[英]npm Fetch Failed. Error Code 504

I'm trying to implement this plugin called Share Button from npm my running https://github.com/carrot/share-button .我正在尝试从运行的 npm https://github.com/carrot/share-button实现这个名为Share Button 的插件。 However after doing that and waiting around 5mins I get the following output:然而,在这样做并等待大约 5 分钟后,我得到以下输出:

npm ERR! fetch failed https://registry.npmjs.org/i/-/i-0.3.2.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 504
⸨    ░░░░░░░░░░░░░░⸩ ⠇ fetchMetadata: WARN retry will retry, error on last attempt: Error: fetch failed with status code 504

Does anyone know why this would happen and a way to get round it?有谁知道为什么会发生这种情况以及解决它的方法? Thanks谢谢

If you tried如果你试过

npm i --save-dev share-button

like me.像我这样的。 Try using the github repo like that尝试像这样使用 github 存储库

npm install --save-dev carrot/share-button

That works without an error on my machine :)这在我的机器上没有错误:)

Try to execute the command below:尝试执行以下命令:

npm config set registry http://registry.npmjs.org/

That will get packages npm install over HTTP.这将通过 HTTP 获取包npm install

Sometimes you also get a 504 error if you have an incompatible npm version.如果您的 npm 版本不兼容,有时您也会收到 504 错误。

npm install -g npm@6.13.4

The npm versions v3, v6 and v8 are partly incompatible. npm 版本 v3、v6 和 v8 部分不兼容。 So just try to install a different npm version.因此,只需尝试安装不同的 npm 版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM