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

Posted

技术标签:

【中文标题】在没有代理的情况下无法使用 npm ECONNRESET 安装任何东西【英文标题】:Can't install anything with npm ECONNRESET without proxy 【发布时间】:2015-06-06 09:29:12 【问题描述】:

我使用 node.js 通过 npm 安装了一些东西,没有任何问题。现在我没有改变我的设置(Win8;没有代理,互联网正在工作),我无法安装任何东西(尤其是科尔多瓦和离子)。 它只会引发错误,就像我在代理后面,但我不是。

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

    npm WARN engine cordova-js@3.8.0: wanted: "node":"~0.10.x" (current: "node":"0.12.1","npm":"2.5.1")
npm WARN engine npm@1.3.4: wanted: "node":">=0.6","npm":"1" (current: "node":"0.12.1","npm":"2.5.1")
npm WARN engine xmlbuilder@2.2.1: 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
i@0.3.2 C:\Users\Basti\AppData\Roaming\npm\node_modules\i

cordova@4.3.0 C:\Users\Basti\AppData\Roaming\npm\node_modules\cordova
Ôö£ÔöÇÔöÇ underscore@1.7.0
Ôö£ÔöÇÔöÇ q@1.0.1
Ôö£ÔöÇÔöÇ nopt@3.0.1 (abbrev@1.0.5)
ÔööÔöÇÔöÇ cordova-lib@4.3.0 (valid-identifier@0.0.1, osenv@0.1.0, properties-parser@0.2.3, bplist-parser@0.0.6, mime@1.2.11, semver@2.0.11, unorm@1.3.3, shelljs@0.3.0, dep-graph@1.1.0, d8@0.4.4, rc@0.5.2, through2@0.6.3, npmconf@0.1.16, glob@4.0.6, xcode@0.6.7, init-package-json@1.3.0, elementtree@0.1.5, request@2.47.0, tar@1.0.2, plist@1.1.0, npm@1.3.4, cordova-js@3.8.0)

ionic@1.3.18 C:\Users\Basti\AppData\Roaming\npm\node_modules\ionic
Ôö£ÔöÇÔöÇ proxy-middleware@0.7.0
Ôö£ÔöÇÔöÇ connect-livereload@0.5.2
Ôö£ÔöÇÔöÇ progress@1.1.7
Ôö£ÔöÇÔöÇ colors@0.6.2
Ôö£ÔöÇÔöÇ open@0.0.5
Ôö£ÔöÇÔöÇ underscore@1.7.0
Ôö£ÔöÇÔöÇ ncp@0.4.2
Ôö£ÔöÇÔöÇ crc@3.2.1
Ôö£ÔöÇÔöÇ async@0.9.0
Ôö£ÔöÇÔöÇ q@1.0.1
Ôö£ÔöÇÔöÇ semver@4.3.1
Ôö£ÔöÇÔöÇ shelljs@0.2.6
Ôö£ÔöÇÔöÇ cross-spawn@0.2.3 (lru-cache@2.5.0)
Ôö£ÔöÇÔöÇ event-stream@3.0.20 (stream-combiner@0.0.4, duplexer@0.1.1, from@0.1.3, pause-stream@0.0.11, map-stream@0.0.5, split@0.2.10, through@2.3.6)
Ôö£ÔöÇÔöÇ optimist@0.6.0 (wordwrap@0.0.2, minimist@0.0.10)
Ôö£ÔöÇÔöÇ opbeat-ionic@1.1.3 (json-stringify-safe@5.0.0, console-log-level@1.0.0, stackman@0.2.2, after-all@2.0.1)
Ôö£ÔöÇÔöÇ form-data@0.1.4 (mime@1.2.11, combined-stream@0.0.7)
Ôö£ÔöÇÔöÇ finalhandler@0.2.0 (escape-html@1.0.1, debug@2.0.0)
Ôö£ÔöÇÔöÇ connect@3.1.1 (utils-merge@1.0.0, parseurl@1.3.0, debug@1.0.4, finalhandler@0.1.0)
Ôö£ÔöÇÔöÇ serve-static@1.7.1 (utils-merge@1.0.0, escape-html@1.0.1, parseurl@1.3.0, send@0.10.1)
Ôö£ÔöÇÔöÇ tiny-lr-fork@0.0.5 (debug@0.7.4, faye-websocket@0.4.4, qs@0.5.6, noptify@0.0.3)
Ôö£ÔöÇÔöÇ xml2js@0.4.4 (sax@0.6.1, xmlbuilder@2.6.2)
Ôö£ÔöÇÔöÇ unzip@0.1.9 (setimmediate@1.0.2, pullstream@0.4.1, match-stream@0.0.2, readable-stream@1.0.33, binary@0.3.0, fstream@0.1.31)
Ôö£ÔöÇÔöÇ request@2.51.0 (caseless@0.8.0, json-stringify-safe@5.0.0, aws-sign2@0.5.0, forever-agent@0.5.2, stringstream@0.0.4, oauth-sign@0.5.0, tunnel-agent@0.4.0, node-uuid@1.4.3, qs@2.3.3, mime-types@1.0.2, combined-stream@0.0.7, tough-cookie@0.12.1, http-signature@0.10.1, form-data@0.2.0, hawk@1.1.1, bl@0.9.4)
Ôö£ÔöÇÔöÇ npm@2.1.3
Ôö£ÔöÇÔöÇ prompt@0.2.12 (revalidator@0.1.8, pkginfo@0.3.0, read@1.0.5, utile@0.2.1, winston@0.6.2)
Ôö£ÔöÇÔöÇ archiver@0.5.1 (lodash@2.4.1, readable-stream@1.1.13, lazystream@0.1.0, zip-stream@0.1.4, file-utils@0.1.5)
Ôö£ÔöÇÔöÇ vinyl-fs@0.3.7 (graceful-fs@3.0.6, lodash@2.4.1, vinyl@0.4.6, mkdirp@0.5.0, strip-bom@1.0.0, through2@0.6.3, glob-stream@3.1.18, glob-watcher@0.0.6)
ÔööÔöÇÔöÇ gulp@3.8.8 (pretty-hrtime@0.2.2, interpret@0.3.10, deprecated@0.0.1, archy@0.0.2, minimist@1.1.1, semver@3.0.1, tildify@1.0.0, orchestrator@0.3.7, liftoff@0.12.1, chalk@0.5.1, gulp-util@3.0.4)

谁能帮帮我?

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

C:\Users\Basti\Desktop>npm install i -g cordova
npm WARN engine npm@1.3.4: wanted: "node":">=0.6","npm":"1" (current: "node":"0.10.38","npm":"2.7.4")
npm WARN installMany normalize-package-data was bundled with npm@1.3.4, 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
i@0.3.2 C:\Program Files (x86)\nodejs\node_modules\i

cordova@4.3.0 C:\Program Files (x86)\nodejs\node_modules\cordova
Ôö£ÔöÇÔöÇ underscore@1.7.0
Ôö£ÔöÇÔöÇ q@1.0.1
Ôö£ÔöÇÔöÇ nopt@3.0.1 (abbrev@1.0.5)
ÔööÔöÇÔöÇ cordova-lib@4.3.0 (valid-identifier@0.0.1, osenv@0.1.0, properties-parser@0.2.3, bplist-parser@0.0.6, mime@1.2.11, semver@2.0.11, unorm@1.3.3, rc@0.5.2, shelljs@0.3.0, dep-graph@1.1.0, npmconf@0.1.16, through2@0.6.3, xcode@0.6.7, init-package-json@1.3.0, d8@0.4.4, elementtree@0.1.5, request@2.47.0, glob@4.0.6, tar@1.0.2, plist@1.1.0, cordova-js@3.8.0, npm@1.3.4)

【问题讨论】:

尝试以管理员身份打开命令行?这有区别吗? 试试powershell,我成功了 npm not working - "read ECONNRESET" 的可能重复项 【参考方案1】:

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

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

使用

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

以便 npm 请求 http url 而不是 https

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

不要忘记通过 npm cache clean 清除缓存。

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

【讨论】:

谢谢,伙计!我不得不从我的 Mint 盒子降级到这个 s**t windows 8 并且我已经花了一周的时间来尝试构建我的开发环境。这完全摆脱了网络错误。 谢谢。 +1 这对我也有帮助。 在没有 SSL 的情况下安装 npm 模块是一个非常糟糕的主意。如果有人拦截了请求,他们几乎可以返回任何内容,并且恶意节点模块可以在其postinstall 任务中以当前用户身份运行任意代码。 你是对的@ivarni。这种方式并不安全。我不建议在生产中使用它。【参考方案2】:

以下内容对我有用

    不要使用 cmd,而是使用“Node.js 命令提示符”。为此,请在开始菜单中键入 node,然后在结果中单击“Node.js commandprompt”。这将设置所需的环境变量 在上面的shell中,运行命令

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

    运行命令

npm install -g 科尔多瓦

    运行命令

npm install -g 离子

【讨论】:

【参考方案3】:

在带有 Node v5.0.0 的 Windows 10 上遇到类似问题

here 的另一个解决方案适合我:

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

【讨论】:

【参考方案4】:

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

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

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

【讨论】:

【参考方案5】:

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

【讨论】:

【参考方案6】:

我遇到了类似的问题。

我在命令下运行

npm 配置编辑

打开该文件并删除第 8 行 代理=http://github.com/ 注册表=http://registry.npmjs.org/ 这些是用户自定义设置删除此文件并保存。

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

【讨论】:

我不知道为什么,但由于某种原因,我的配置有一个本地机器 (127.0.0.1) 的代理。删除它解决了问题。谢谢【参考方案7】:

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

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

npm config edit

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

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

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

【讨论】:

【参考方案8】:

如果您在 corpnet 中使用代理并且所提供的解决方案均不适合您,则很可能您需要向代理提供您的凭据,如下所示:

npm 配置设置代理 http://username:password@host:port

npm 配置设置 https-proxy http://username:password@host:port

今天我花了很多时间,希望这篇文章能节省你的一些时间。

【讨论】:

【参考方案9】:

我在安装 jdbc 包时遇到了类似的问题。我也支持代理。我使用了强制安装,它成功了。

npm i jdbc --force

注意:请确保您通过查看文档了解 --force install 的后果。

【讨论】:

以上是关于在没有代理的情况下无法使用 npm ECONNRESET 安装任何东西的主要内容,如果未能解决你的问题,请参考以下文章

如何在没有“dist”的情况下在 NPM 上发布 TypeScript 模块?

HTTPS代理环境,npm安装webpack

StackBlitz ngcc 在启用 Ivy 的情况下无法在我的 npm 库上运行

NPM离线包的制作和使用

NPM离线包的制作和使用

如何在没有 npm 要求的情况下使用 ReactRouter CDN 方式?