Angular-cli: error Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?

Created on 14 Jun 2017  路  4Comments  路  Source: angular/angular-cli

closing because I can only recreate while in a specific existing angular project
attempting to install angular CLI globally from an empty sibling directory of this project works

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

node --version v8.1.1
npm --version 5.0.3
OSX El Capitan 10.11.6

Repro steps.

  1. use node 8.1.1 and npm 5.0.3
  2. try to install @angular cli globally (npm i -g @angular/cli)

The log given by the failure.

npm ERR! Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?


stack trace (click to expand)
11165 verbose stack Error: Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?
11165 verbose stack at Object.exports.decode (/Users/plawler/.nvm/versions/node/v8.1.1/lib/node_modules/npm/node_modules/pacote/node_modules/tar-stream/headers.js:270:43)
11165 verbose stack at Extract.onheader [as _onparse] (/Users/plawler/.nvm/versions/node/v8.1.1/lib/node_modules/npm/node_modules/pacote/node_modules/tar-stream/extract.js:120:39)
11165 verbose stack at Extract._write (/Users/plawler/.nvm/versions/node/v8.1.1/lib/node_modules/npm/node_modules/pacote/node_modules/tar-stream/extract.js:243:8)
11165 verbose stack at doWrite (/Users/plawler/.nvm/versions/node/v8.1.1/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:337:64)
11165 verbose stack at writeOrBuffer (/Users/plawler/.nvm/versions/node/v8.1.1/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:326:5)
11165 verbose stack at Extract.Writable.write (/Users/plawler/.nvm/versions/node/v8.1.1/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js:263:11)
11165 verbose stack at Duplexify.ondata (/Users/plawler/.nvm/versions/node/v8.1.1/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_readable.js:540:20)
11165 verbose stack at emitOne (events.js:115:13)
11165 verbose stack at Duplexify.emit (events.js:210:7)
11165 verbose stack at readableAddChunk (/Users/plawler/.nvm/versions/node/v8.1.1/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_readable.js:211:18)
11165 verbose stack at Duplexify.Readable.push (/Users/plawler/.nvm/versions/node/v8.1.1/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_readable.js:170:10)
11165 verbose stack at Duplexify._forward (/Users/plawler/.nvm/versions/node/v8.1.1/lib/node_modules/npm/node_modules/mississippi/node_modules/duplexify/index.js:163:26)
11165 verbose stack at DestroyableTransform.onreadable (/Users/plawler/.nvm/versions/node/v8.1.1/lib/node_modules/npm/node_modules/mississippi/node_modules/duplexify/index.js:127:10)
11165 verbose stack at emitNone (events.js:105:13)
11165 verbose stack at DestroyableTransform.emit (events.js:207:7)
11165 verbose stack at emitReadable_ (/Users/plawler/.nvm/versions/node/v8.1.1/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_readable.js:428:10)
11165 verbose stack at emitReadable (/Users/plawler/.nvm/versions/node/v8.1.1/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_readable.js:422:65)
11166 verbose cwd /Users/plawler/Documents/AtomProjects/localDev/clientdashboard
11167 verbose Darwin 15.6.0
11168 verbose argv "/Users/plawler/.nvm/versions/node/v8.1.1/bin/node" "/Users/plawler/.nvm/versions/node/v8.1.1/bin/npm" "i" "-g" "@angular/cli"
11169 verbose node v8.1.1
11170 verbose npm v5.0.3
11171 error Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?
11172 verbose exit [ 1, true ]

Desired functionality.

global installation of angular cli working

Mention any other details that might be useful.

All 4 comments

This issue went away after I deleted ~/.npmrc and uninstalled + reinstalled this version of node (using nvm)

Could you please provide the detailed steps of how you resolved the issue. I am stuck

  1. delete node_modules/ in your project folder
  2. delete ~/.npmrc
  3. uninstall nodejs and npm
  4. reinstall the latest nodejs and npm

(I am using nvm to manage my nodejs and npm installations, if you are using nvm then the last two steps are easy, if you did a manual installation, then the last two steps are a little more difficult. I recommend using nvm and removing any manually installed versions of nodejs and npm anyways)

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

5amfung picture 5amfung  路  3Comments

IngvarKofoed picture IngvarKofoed  路  3Comments

rajjejosefsson picture rajjejosefsson  路  3Comments

daBishMan picture daBishMan  路  3Comments

jmurphzyo picture jmurphzyo  路  3Comments