尝试在我的Windows 8.1计算机上通过npm安装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
(同样的命令在我的Mac OS X上工作正常,它位于同一网络中。)
这些是我的(最新稳定版)(在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
查看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 ]
在此处找到类似但不相同的问题:npm ERR! fetch failed status code 502
有人遇到同样的问题吗?
此处提交了一张票,以防万一:https://github.com/npm/npm/issues/14510
答案 0 :(得分:0)
答案 1 :(得分:0)
我发现了问题。这是我们办公室网络中的Sophos过滤器的问题。
当我尝试在浏览器中访问http://registry.npmjs.org/tar/-/tar-2.2.1.tgz时,我得到:
由于以下情况,无法发送内容: 扫描无法继续,文件已损坏
屏幕截图:https://snag.gy/THdcZF.jpg
在Sophos论坛中发现了这个问题:
(我的Mac使用的是公司的wifi,但不是域的一部分,而我的Windows PC则是。)