0

It try to install angular-cli via npm on my Windows 8.1 machine and getting the error:

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).

These are my (latest stable) versions (on 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:

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! fetch failed status code 502

Anybody having the same problems?

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

Community
  • 1
  • 1
Mathias Conradt
  • 28,420
  • 21
  • 138
  • 192

2 Answers2

0

I had a similar problem when using node 7. This seems to be related to changes in fs. When switching to node 5.10.1 things worked fine.

Here is a guide how to switch versions.

After the update, type:

sudo n 5.10.1

and try to install again.

Meir
  • 14,081
  • 4
  • 39
  • 47
  • Thanks, I will give that a try. But already at the next issue, cause `n` does not install, failing with EBADPLATFORM. http://pastebin.com/WU6WdqXu Need to figure that out first :) I am on x64 Windows 8.1. – Mathias Conradt Nov 03 '16 at 09:43
  • What are you running on? – Meir Nov 03 '16 at 09:44
  • strange. Did you try running in an admin shell? – Meir Nov 03 '16 at 09:45
  • Yes, admin shell. No idea why it thinks I am on an os:win32. It's not a VM, regular Win8.1 system. And definitely installed/using node-v6.9.1-x64.msi – Mathias Conradt Nov 03 '16 at 09:47
  • Installed node 5.10.1 via .msi now, after uninstalling node 6.x. Still getting the same error 500 though. http://pastebin.com/ZCTNWJWQ I will try the same later on Mac, maybe I will have more luck there. – Mathias Conradt Nov 03 '16 at 09:56
  • Issue regarding EBADPLATFORM filed: https://github.com/npm/npm/issues/14512 – Mathias Conradt Nov 03 '16 at 10:34
  • Not tested yet. Will try it later tonight. – Mathias Conradt Nov 03 '16 at 10:47
  • You can see my update here https://github.com/npm/npm/issues/14510#issuecomment-258192596: on my Mac (in the same network), I can install angular-cli just fine. On Windows, I still get the 500 error. – Mathias Conradt Nov 04 '16 at 07:09
  • By the way: "n" is not available for Windows, therefore it failed. Error message is a bit misleading. https://github.com/npm/npm/issues/14512#issuecomment-258159431 – Mathias Conradt Nov 04 '16 at 07:12
0

I found the problem. It was a problem with the Sophos filter that we have here in the office network.

When I try to access http://registry.npmjs.org/tar/-/tar-2.2.1.tgz in the browser, I get:

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

Found this issue reported in the Sophos forum:

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

(My Mac was using the company wifi but is not part of the domain, while my Windows PC is.)

Mathias Conradt
  • 28,420
  • 21
  • 138
  • 192