简体   繁体   English

npm安装失败,ECONNRESET失败

[英]npm install anything failes with ECONNRESET

I'm having a huge issue with npm not being able to install anything on a virtual machine in a data centre because I keep getting ECONNRESET fails. 我遇到了一个很大的问题,npm无法在数据中心的虚拟机上安装任何东西,因为我不断收到ECONNRESET失败。

I've tried the set registry from http to https and back again with no change and I can't even upgrade npm without it failing. 我已经尝试过将设置注册表从http更改为https,然后再无更改返回,即使没有失败我也无法升级npm。

I've been at this for a day now and am getting no where, hence the request. 我已经在这里待了一天,却无处可寻,因此提出了要求。

I'm ultimately trying to install a meteor app with mup if that makes any difference. 如果有任何不同,我最终将尝试使用mup安装流星应用程序。

The output from the last attempt is 上一次尝试的输出是

taralga-infolite% npm install npm@latest -g
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! System Linux 3.13.0-74-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "npm@latest" "-g"
npm ERR! cwd /home/pnunn
npm ERR! node -v v0.10.36
npm ERR! npm -v 1.4.28
npm ERR! syscall read
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/pnunn/npm-debug.log
npm ERR! not ok code 0

The log file is 日志文件是

1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'install', 'npm@latest', '-g' ]
2 info using npm@1.4.28
3 info using node@v0.10.36
4 verbose node symlink /usr/bin/node
5 verbose cache add [ 'npm@latest', null ]
6 verbose cache add name=undefined spec="npm@latest" args=["npm@latest",null]
7 verbose parsed url { protocol: null,
7 verbose parsed url   slashes: null,
7 verbose parsed url   auth: null,
7 verbose parsed url   host: null,
7 verbose parsed url   port: null,
7 verbose parsed url   hostname: null,
7 verbose parsed url   hash: null,
7 verbose parsed url   search: null,
7 verbose parsed url   query: null,
7 verbose parsed url   pathname: 'npm@latest',
7 verbose parsed url   path: 'npm@latest',
7 verbose parsed url   href: 'npm@latest' }
8 verbose cache add name="npm" spec="latest" args=["npm","latest"]
9 verbose parsed url { protocol: null,
9 verbose parsed url   slashes: null,
9 verbose parsed url   auth: null,
9 verbose parsed url   host: null,
9 verbose parsed url   port: null,
9 verbose parsed url   hostname: null,
9 verbose parsed url   hash: null,
9 verbose parsed url   search: null,
9 verbose parsed url   query: null,
9 verbose parsed url   pathname: 'latest',
9 verbose parsed url   path: 'latest',
9 verbose parsed url   href: 'latest' }
10 verbose addNamed [ 'npm', 'latest' ]
11 verbose addNamed [ null, null ]
12 silly lockFile 588f5fcc-npm-latest npm@latest
13 verbose lock npm@latest /home/pnunn/.npm/588f5fcc-npm-latest.lock
14 info addNameTag [ 'npm', 'latest' ]
15 verbose request where is /npm
16 verbose request registry http://registry.npmjs.org/
17 verbose request id 08cd751c52e5f075
18 verbose url raw /npm
19 verbose url resolving [ 'http://registry.npmjs.org/', './npm' ]
20 verbose url resolved http://registry.npmjs.org/npm
21 verbose request where is http://registry.npmjs.org/npm
22 info trying registry request attempt 1 at 13:51:28
23 http GET http://registry.npmjs.org/npm
24 info retry will retry, error on last attempt: Error: read ECONNRESET
25 info trying registry request attempt 2 at 13:51:38
26 http GET http://registry.npmjs.org/npm
27 info retry will retry, error on last attempt: Error: read ECONNRESET
28 info trying registry request attempt 3 at 13:52:38
29 http GET http://registry.npmjs.org/npm
30 silly lockFile 588f5fcc-npm-latest npm@latest
31 silly lockFile 588f5fcc-npm-latest npm@latest
32 error network read ECONNRESET
32 error network This is most likely not a problem with npm itself
32 error network and is related to network connectivity.
32 error network In most cases you are behind a proxy or have bad network settings.
32 error network
32 error network If you are behind a proxy, please make sure that the
32 error network 'proxy' config is set properly.  See: 'npm help config'
33 error System Linux 3.13.0-74-generic
34 error command "/usr/bin/node" "/usr/bin/npm" "install" "npm@latest" "-g"
35 error cwd /home/pnunn
36 error node -v v0.10.36
37 error npm -v 1.4.28
38 error syscall read
39 error code ECONNRESET
40 error errno ECONNRESET
41 verbose exit [ 1, true ]

I get basically the same thing if I try and npm install underscore or npm install server (which are the two current packages the mup install is failing on). 如果尝试使用npm install underscore或npm install server(这是mup安装失败的两个当前软件包),我会得到基本相同的结果。

I've run a tracert (actually mtr) to registry.npmjs.org and am getting no packet loss at all. 我已经运行了tracert(实际上是mtr)到Registry.npmjs.org,并且完全没有丢包。

Any suggestions on what else to try? 还有其他建议可以尝试吗?

Ta

Peter. 彼得。

Finally figured out a way to make this work. 最后想出了一种方法来完成这项工作。

Turns out the answer is two fold... firstly, update npm to the latest version. 答案是两个方面的...首先,将npm更新到最新版本。 To do this on my system I had to do 要在我的系统上执行此操作

sudo mv /usr/bin/npm /usr/bin/npm.old
sudo /usr/bin/npm.old install npm -g

Then change the registry to use the mirror and do this globally (it took me ages to work out I missed the -g flag in the configuration) 然后更改注册表以使用镜像并全局执行此操作(花了我很长时间才弄清楚我错过了配置中的-g标志)

sudo npm config set registry https://skimdb.npmjs.com/registry -g

I also increased the number of retries to 10 我还将重试次数增加到10次

sudo npm config set fetch-retries 10 -g

My /etc/npmrc file is now 我的/ etc / npmrc文件现在

registry=https://skimdb.npmjs.com/registry
fetch-retries=10

which is actually the easier way to set these on a linux system. 实际上,这是在Linux系统上进行设置的更简单方法。

mup takes a while to deploy the sites, but at least it now works reliably. mup需要一些时间来部署站点,但是至少现在它可以可靠地工作了。 There is definitely a problem with the default npm registry. 默认的npm注册表肯定存在问题。 I used wget to download a number of the .tgz packages npm was having problems with and it would take up to 10 attempts to get a connection that was not immediately reset by the server. 我使用wget下载了许多npm出现问题的.tgz程序包,最多需要10次尝试才能获得服务器未立即重置的连接。 The mirror seems to be much more stable. 镜子似乎要稳定得多。

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

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