node.js 无法在没有代理的情况下使用 npm ECONNRESET 安装任何东西

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29395793/
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 18:36:24  来源:igfitidea点击:

Can't install anything with npm ECONNRESET without proxy

node.jscordovaproxynpmionic

提问by bastifix

I used node.js to install some things via npm without any problems. Now I changed nothing on my settings (Win8; no proxy, internet is working) and I can't install anything (especially cordova and ionic). It only throws errors like I'm behind a proxy, but I'm not.

我使用 node.js 通过 npm 安装了一些东西,没有任何问题。现在我没有更改我的设置(Win8;没有代理,互联网正在工作)并且我无法安装任何东西(尤其是cordova和ionic)。它只会抛出错误,就像我在代理后面一样,但我不是。

npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "i" "-g" "ionic"
npm ERR! node v0.12.1
npm ERR! npm  v2.5.1
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! syscall read

npm ERR! network read ECONNRESET
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network 
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! Please include the following file with any support request:
npm ERR!     D:\Web\dierechnungstimmt\npm-debug.log

and

    npm WARN engine [email protected]: wanted: {"node":"~0.10.x"} (current: {"node":"0.12.1","npm":"2.5.1"})
npm WARN engine [email protected]: wanted: {"node":">=0.6","npm":"1"} (current: {"node":"0.12.1","npm":"2.5.1"})
npm WARN engine [email protected]: wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"0.12.1","npm":"2.5.1"})
npm ERR! fetch failed https://registry.npmjs.org/stack-trace/-/stack-trace-0.0.9.tgz
npm WARN retry will retry, error on last attempt: Error: read ECONNRESET
npm ERR! fetch failed https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.0.tgz
npm WARN retry will retry, error on last attempt: Error: read ECONNRESET
npm ERR! fetch failed https://registry.npmjs.org/gaze/-/gaze-0.5.1.tgz
npm WARN retry will retry, error on last attempt: Error: read ECONNRESET
npm ERR! fetch failed https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz
npm WARN retry will retry, error on last attempt: Error: read ECONNRESET
npm ERR! fetch failed https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.3.0.tgz
npm WARN retry will retry, error on last attempt: Error: read ECONNRESET
npm ERR! fetch failed https://registry.npmjs.org/stream-consume/-/stream-consume-0.1.0.tgz
npm WARN retry will retry, error on last attempt: Error: read ECONNRESET
npm ERR! fetch failed https://registry.npmjs.org/lodash._reescape/-/lodash._reescape-3.0.0.tgz
npm WARN retry will retry, error on last attempt: Error: read ECONNRESET
npm ERR! fetch failed https://registry.npmjs.org/through2/-/through2-0.6.3.tgz
npm WARN retry will retry, error on last attempt: Error: read ECONNRESET
npm ERR! fetch failed https://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz
npm WARN retry will retry, error on last attempt: Error: read ECONNRESET
npm ERR! fetch failed https://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz
npm WARN retry will retry, error on last attempt: Error: read ECONNRESET
npm ERR! fetch failed https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.0.tgz
npm WARN retry will retry, error on last attempt: Error: read ECONNRESET
npm ERR! fetch failed https://registry.npmjs.org/clone/-/clone-0.2.0.tgz
npm WARN retry will retry, error on last attempt: Error: read ECONNRESET
npm ERR! fetch failed https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.13.tgz
npm WARN retry will retry, error on last attempt: Error: read ECONNRESET
npm ERR! fetch failed https://registry.npmjs.org/minimatch/-/minimatch-0.2.14.tgz
npm WARN retry will retry, error on last attempt: Error: read ECONNRESET
npm ERR! fetch failed https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.13.tgz
npm WARN retry will retry, error on last attempt: Error: read ECONNRESET
C:\Users\Basti\AppData\Roaming\npm\cordova -> C:\Users\Basti\AppData\Roaming\npm\node_modules\cordova\bin\cordova
npm ERR! fetch failed https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz
npm WARN retry will retry, error on last attempt: Error: read ECONNRESET
C:\Users\Basti\AppData\Roaming\npm\ionic -> C:\Users\Basti\AppData\Roaming\npm\node_modules\ionic\bin\ionic
[email protected] C:\Users\Basti\AppData\Roaming\npm\node_modules\i

[email protected] C:\Users\Basti\AppData\Roaming\npm\node_modules\cordova
??£?????? [email protected]
??£?????? [email protected]
??£?????? [email protected] ([email protected])
????????? [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])

[email protected] C:\Users\Basti\AppData\Roaming\npm\node_modules\ionic
??£?????? [email protected]
??£?????? [email protected]
??£?????? [email protected]
??£?????? [email protected]
??£?????? [email protected]
??£?????? [email protected]
??£?????? [email protected]
??£?????? [email protected]
??£?????? [email protected]
??£?????? [email protected]
??£?????? [email protected]
??£?????? [email protected]
??£?????? [email protected] ([email protected])
??£?????? [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
??£?????? [email protected] ([email protected], [email protected])
??£?????? [email protected] ([email protected], [email protected], [email protected], [email protected])
??£?????? [email protected] ([email protected], [email protected])
??£?????? [email protected] ([email protected], [email protected])
??£?????? [email protected] ([email protected], [email protected], [email protected], [email protected])
??£?????? [email protected] ([email protected], [email protected], [email protected], [email protected])
??£?????? [email protected] ([email protected], [email protected], [email protected], [email protected])
??£?????? [email protected] ([email protected], [email protected])
??£?????? [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
??£?????? [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
??£?????? [email protected]
??£?????? [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
??£?????? [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
??£?????? [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
????????? [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])

Can anyone please help me?

谁能帮帮我吗?

EDIT: Tried to downgrade to node 0.10 an run cmd as administrator, but it still doesn't work:

编辑:试图降级到节点 0.10 并以管理员身份运行 cmd,但它仍然不起作用:

C:\Users\Basti\Desktop>npm install i -g cordova
npm WARN engine [email protected]: wanted: {"node":">=0.6","npm":"1"} (current: {"node":"0.10.38","npm":"2.7.4"})
npm WARN installMany normalize-package-data was bundled with [email protected], but bundled package wasn't found in unpacked tree
C:\Program Files (x86)\nodejs\cordova -> C:\Program Files (x86)\nodejs\node_modules\cordova\bin\cordova
[email protected] C:\Program Files (x86)\nodejs\node_modules\i

[email protected] C:\Program Files (x86)\nodejs\node_modules\cordova
??£?????? [email protected]
??£?????? [email protected]
??£?????? [email protected] ([email protected])
????????? [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])

回答by meisyal

Well, actually, I want to give a comment to your question. Because I have low reputation, it means I can't give a.

嗯,实际上,我想对您的问题发表评论。因为我声望低,所以不能给。

If you have a trouble with npmon Windows. I would suggest you take a look the common errors of npmon wiki here. Back to your problem, please make sure you are using internet connection along with proxy or not. If you are using it, please do command npm config set proxy. I found same problem on Stackoverflowand the solution is:

如果您npm在 Windows 上遇到问题。我建议您npm这里查看 wiki 上的常见错误。回到您的问题,请确保您正在使用互联网连接和代理。如果您正在使用它,请执行命令npm config set proxy。我在Stackoverflow上发现了同样的问题,解决方案是:

use

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

so that npm requests for httpurl instead of https.

and then try the same npm installcommand.

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

以便 npm 请求httpurl 而不是https.

然后尝试相同的npm install命令。

Don't forget to clear your cache by doing npm cache clean.

不要忘记通过执行npm cache clean.

Although, this way can solve the problem. You should consider about the security. This way is not the safe waybecause it can lead to security problem since httpsis not used here. I don't recommend to use this on production (thanks @ivarni for pointing this out).

虽然,这种方式可以解决问题。您应该考虑安全性。这种方式不是安全的方式,因为https这里不使用它会导致安全问题。我不建议在生产中使用它(感谢 @ivarni 指出这一点)。

回答by Sunil Purushothaman

The following worked for me

以下对我有用

  1. Instead of using cmd, use the "Node.js commandprompt". To do this, type node in start menu, and on the results, click on "Node.js commandprompt". This will setup the required env variables
  2. In the above shell, run the command
  1. 不要使用 cmd,而是使用“Node.js commandprompt”。为此,请在开始菜单中键入 node,然后在结果中单击“Node.js commandprompt”。这将设置所需的环境变量
  2. 在上面的shell中,运行命令

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

npm 配置设置注册表http://registry.npmjs.org/

  1. Run the command
  1. 运行命令

npm install -g cordova

npm install -g 科尔多瓦

  1. Run the command
  1. 运行命令

npm install -g ionic

npm install -g 离子

回答by bharat

I was got a similar issue.

我遇到了类似的问题。

I was run below commands

我在命令下运行

npm config edit

npm 配置编辑

Open that file and remove line no approx 8 proxy=http://github.com/registry=http://registry.npmjs.org/those are user custom settings remove this file and save it.

打开该文件并删除行 no approx 8 proxy= http://github.com/registry= http://registry.npmjs.org/这些是用户自定义设置,删除此文件并保存。

After run below command npm install should be work fine.

运行以下命令 npm install 后应该可以正常工作。

回答by Surya

I had the same issue while installing the expo-cli in Windows 8.1, but it resolved after i have followed the below steps.

我在 Windows 8.1 中安装 expo-cli 时遇到了同样的问题,但在我按照以下步骤操作后解决了。

run below command in your command prompt.

在命令提示符下运行以下命令。

npm config edit

.npmrc file will open in your default editor.

.npmrc 文件将在您的默认编辑器中打开。

Now remove the lines having proxy, https-proxy, registery and save that file.

现在删除具有代理、https-proxy、registery 的行并保存该文件。

After that i was able to install the expo-cli package without the proxy issue.

之后,我能够安装 expo-cli 包而没有代理问题。

回答by slowkot

Had the similar issue on Windows 10 with Node v5.0.0

在使用 Node v5.0.0 的 Windows 10 上有类似问题

Another solution from herethat works for me:

这里的另一个对我有用的解决方案:

Try to unistall x64 version of Node.js and install x86 one.

尝试卸载 x64 版本的 Node.js 并安装 x86 版本。

回答by Tony Thomson

The best discussion of the ECONNRESETissue is in this npm registry ticket: https://github.com/npm/registry-issue-archive/issues/10

这个ECONNRESET问题的最佳讨论是在这个 npm 注册表单中:https: //github.com/npm/registry-issue-archive/issues/10

tl;dr: If you are seeing this frequently, it may be a "too many simultaneous connections" issue that can be addressed by updating your version of npm to 2.15.xor 3.x / latest.

tl;dr:如果您经常看到这种情况,则可能是“同时连接过多”的问题,可以通过将您的 npm 版本更新为2.15.x或来解决3.x / latest

One comment (no rep to comment directly) on posts by Shokatsuryō-san & Sunil: both recommend changing your npm registry config to use http over https. Doing so can present a significant security risk in production environments; don't use that fix in those cases.

对 Shokatsuryō-san 和 Sunil 的帖子的一条评论(没有代表直接发表评论):两者都建议更改您的 npm 注册表配置以通过 https 使用 http。这样做会在生产环境中带来重大的安全风险;在这些情况下不要使用该修复程序。

回答by roma98

I actually had the same problem, from my workplace I could install everything fine, but it wasn't working from home. I found out that the custom DNS I set up on my routeur was the problem, I have reverted to the default internet provider one and everything works fine.

我实际上遇到了同样的问题,从我的工作场所我可以安装一切正常,但它不能在家工作。我发现我在路由器上设置的自定义 DNS 是问题所在,我已恢复到默认的 Internet 提供商之一,一切正常。