简体   繁体   English

npm install -g angular-cli失败,错误:错误:读取失败,状态码为500

[英]npm install -g angular-cli fails with: Error: fetch failed with status code 500

It try to install angular-cli via npm on my Windows 8.1 machine and getting the error: 它尝试通过npm在我的Windows 8.1机器上安装angular-cli并收到错误消息:

npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 500
npm ERR! fetch failed http://registry.npmjs.org/tar/-/tar-2.2.1.tgz

(The same command works fine on my Mac OS X, which is in the same network). (同一命令在同一网络上的Mac OS X上可以正常工作)。

These are my (latest stable) versions (on Windows 8.1, x84): 这些是我的(最新的稳定版本)(在Windows 8.1,x84上):

$ node -v
v6.9.1

$ npm -v
3.10.9

$ npm install -g angular-cli
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm ERR! fetch failed http://registry.npmjs.org/tar/-/tar-2.2.1.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 500
npm ERR! fetch failed http://registry.npmjs.org/tar/-/tar-2.2.1.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 500
npm ERR! fetch failed http://registry.npmjs.org/tar/-/tar-2.2.1.tgz
npm ERR! fetch failed http://registry.npmjs.org/npm/-/npm-2.14.21.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 500
npm ERR! fetch failed http://registry.npmjs.org/npm/-/npm-2.14.21.tgz
npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 500
npm ERR! fetch failed http://registry.npmjs.org/npm/-/npm-2.14.21.tgz
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: tar@~2.2.1 (node_modules\angular-cli\node_modules\node-pre-gyp\node_modules\tar):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fetch failed with status code 500
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\mlin\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "angular-cli"
npm ERR! node v6.9.1
npm ERR! npm  v3.10.9

npm ERR! fetch failed with status code 500
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     C:\path\to\npm-debug.log

Looking at the npm-debug.log: 查看npm-debug.log:

16481 verbose afterAdd C:\Users\mlin\AppData\Roaming\npm-cache\bower\1.7.9\package\package.json not in flight; writing
16482 verbose correctMkdir C:\Users\mlin\AppData\Roaming\npm-cache correctMkdir not in flight; initializing
16483 verbose afterAdd C:\Users\mlin\AppData\Roaming\npm-cache\bower\1.7.9\package\package.json written
16484 info attempt registry request try #2 at 9:40:08 AM
16485 http fetch GET http://registry.npmjs.org/npm/-/npm-2.14.21.tgz
16486 http fetch 500 http://registry.npmjs.org/npm/-/npm-2.14.21.tgz
16487 info retry will retry, error on last attempt: Error: server error 500
16488 info attempt registry request try #3 at 9:41:15 AM
16489 http fetch GET http://registry.npmjs.org/npm/-/npm-2.14.21.tgz
16490 http fetch 500 http://registry.npmjs.org/npm/-/npm-2.14.21.tgz
16491 error fetch failed http://registry.npmjs.org/npm/-/npm-2.14.21.tgz
16492 warn retry will retry, error on last attempt: Error: fetch failed with status code 500
16493 info retry fetch attempt 2 at 9:41:33 AM
16494 info attempt registry request try #1 at 9:41:33 AM
16495 http fetch GET http://registry.npmjs.org/npm/-/npm-2.14.21.tgz
16496 http fetch 500 http://registry.npmjs.org/npm/-/npm-2.14.21.tgz
16497 info retry will retry, error on last attempt: Error: server error 500
16498 info attempt registry request try #2 at 9:41:51 AM
16499 http fetch GET http://registry.npmjs.org/npm/-/npm-2.14.21.tgz
16500 http fetch 500 http://registry.npmjs.org/npm/-/npm-2.14.21.tgz
16501 info retry will retry, error on last attempt: Error: server error 500
16502 info attempt registry request try #3 at 9:42:59 AM
16503 http fetch GET http://registry.npmjs.org/npm/-/npm-2.14.21.tgz
16504 http fetch 500 http://registry.npmjs.org/npm/-/npm-2.14.21.tgz
16505 error fetch failed http://registry.npmjs.org/npm/-/npm-2.14.21.tgz
16506 warn retry will retry, error on last attempt: Error: fetch failed with status code 500
16507 info retry fetch attempt 3 at 9:44:07 AM
16508 info attempt registry request try #1 at 9:44:07 AM
16509 http fetch GET http://registry.npmjs.org/npm/-/npm-2.14.21.tgz
16510 http fetch 500 http://registry.npmjs.org/npm/-/npm-2.14.21.tgz
16511 info retry will retry, error on last attempt: Error: server error 500
16512 info attempt registry request try #2 at 9:44:25 AM
16513 http fetch GET http://registry.npmjs.org/npm/-/npm-2.14.21.tgz
16514 http fetch 500 http://registry.npmjs.org/npm/-/npm-2.14.21.tgz
16515 info retry will retry, error on last attempt: Error: server error 500
16516 info attempt registry request try #3 at 9:45:32 AM
16517 http fetch GET http://registry.npmjs.org/npm/-/npm-2.14.21.tgz
16518 http fetch 500 http://registry.npmjs.org/npm/-/npm-2.14.21.tgz
16519 error fetch failed http://registry.npmjs.org/npm/-/npm-2.14.21.tgz
16520 silly rollbackFailedOptional Starting
16521 silly rollbackFailedOptional Finishing
16522 silly runTopLevelLifecycles Finishing
16523 silly install printInstalled
16524 warn optional SKIPPING OPTIONAL DEPENDENCY: tar@~2.2.1 (node_modules\angular-cli\node_modules\node-pre-gyp\node_modules\tar):
16525 warn optional SKIPPING OPTIONAL DEPENDENCY: fetch failed with status code 500
16526 verbose optional SKIPPING OPTIONAL DEPENDENCY:
16526 verbose optional If you need help, you may report this error at:
16526 verbose optional SKIPPING OPTIONAL DEPENDENCY:     <https://github.com/npm/npm/issues>
16527 verbose stack Error: fetch failed with status code 500
16527 verbose stack     at Request.<anonymous> (C:\Users\mlin\AppData\Roaming\npm\node_modules\npm\node_modules\npm-registry-client\lib\fetch.js:51:14)
16527 verbose stack     at emitOne (events.js:96:13)
16527 verbose stack     at Request.emit (events.js:188:7)
16527 verbose stack     at Request.onRequestResponse (C:\Users\mlin\AppData\Roaming\npm\node_modules\npm\node_modules\request\request.js:954:10)
16527 verbose stack     at emitOne (events.js:96:13)
16527 verbose stack     at ClientRequest.emit (events.js:188:7)
16527 verbose stack     at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:474:21)
16527 verbose stack     at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23)
16527 verbose stack     at Socket.socketOnData (_http_client.js:363:20)
16527 verbose stack     at emitOne (events.js:96:13)
16527 verbose stack     at Socket.emit (events.js:188:7)
16528 verbose cwd C:\Users\mlin\Projects\jDocuments
16529 error Windows_NT 6.3.9600
16530 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\mlin\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "angular-cli"
16531 error node v6.9.1
16532 error npm  v3.10.9
16533 error fetch failed with status code 500
16534 error If you need help, you may report this error at:
16534 error     <https://github.com/npm/npm/issues>
16535 verbose exit [ 1, true ]

Found a similar but not the same issue here: npm ERR! 在此处找到类似但不相同的问题: npm ERR! fetch failed status code 502 获取失败状态码502

Anybody having the same problems? 有人有同样的问题吗?

Filed a ticket here just in case: https://github.com/npm/npm/issues/14510 以防万一: https : //github.com/npm/npm/issues/14510

I had a similar problem when using node 7. This seems to be related to changes in fs. 使用节点7时,我遇到了类似的问题。这似乎与fs的更改有关。 When switching to node 5.10.1 things worked fine. 切换到节点5.10.1时,一切正常。

Here is a guide how to switch versions. 这是如何切换版本的指南

After the update, type: 更新后,键入:

sudo n 5.10.1

and try to install again. 并尝试再次安装。

I found the problem. 我发现了问题。 It was a problem with the Sophos filter that we have here in the office network. 我们办公室网络中的Sophos过滤器存在问题。

When I try to access http://registry.npmjs.org/tar/-/tar-2.2.1.tgz in the browser, I get: 当我尝试在浏览器中访问http://registry.npmjs.org/tar/-/tar-2.2.1.tgz时,我得到:

The content could not be delivered due to the following condition: Sweep could not proceed, the file was corrupted 由于以下情况,无法传送内容:扫描无法继续,文件已损坏

Screenshot: https://snag.gy/THdcZF.jpg 截图: https//snag.gy/THdcZF.jpg

Found this issue reported in the Sophos forum: 在Sophos论坛中发现了此问题的报告:

https://community.sophos.com/products/unified-threat-management/f/web-protection-web-filtering-application-visibility-control/79592/problem-downloading-a-zip-file---error-message-is-sweep-could-not-proceed-the-file-was-corrupted https://community.sophos.com/products/unified-threat-management/f/web-protection-web-filtering-application-visibility-control/79592/problem-downloading-a-zip-file---error-消息无法处理,文件已损坏

(My Mac was using the company wifi but is not part of the domain, while my Windows PC is.) (我的Mac使用的是公司wifi,但不属于域的一部分,而Windows PC是。)

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

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