angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

ng new fails to create app, unhandled error event

Open johren02 opened this issue 8 years ago • 4 comments

Bug Report or Feature Request (mark with an x)

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

Area

- [ x ] devkit
- [ ] schematics

Versions

Node v9.11.1 NPM v6.0.1 MacOS High Sierra running Hyper Terminal on new installation of Angular CLI (v6.0.8)

Repro steps

  1. Freshly uninstall and install angular CLI
  2. Run ng new appname
  3. Install fails

The log given by the failure

Mathias:~ John$ cd projects
Mathias:projects John$ ng new testmod
CREATE testmod/README.md (1024 bytes)
CREATE testmod/angular.json (3412 bytes)
CREATE testmod/package.json (1311 bytes)
CREATE testmod/tsconfig.json (384 bytes)
CREATE testmod/tslint.json (2805 bytes)
CREATE testmod/.editorconfig (245 bytes)
CREATE testmod/.gitignore (503 bytes)
CREATE testmod/src/environments/environment.prod.ts (51 bytes)
CREATE testmod/src/environments/environment.ts (631 bytes)
CREATE testmod/src/favicon.ico (5430 bytes)
CREATE testmod/src/index.html (294 bytes)
CREATE testmod/src/main.ts (370 bytes)
CREATE testmod/src/polyfills.ts (3194 bytes)
CREATE testmod/src/test.ts (642 bytes)
CREATE testmod/src/assets/.gitkeep (0 bytes)
CREATE testmod/src/styles.css (80 bytes)
CREATE testmod/src/browserslist (375 bytes)
CREATE testmod/src/karma.conf.js (964 bytes)
CREATE testmod/src/tsconfig.app.json (194 bytes)
CREATE testmod/src/tsconfig.spec.json (282 bytes)
CREATE testmod/src/tslint.json (314 bytes)
CREATE testmod/src/app/app.module.ts (314 bytes)
CREATE testmod/src/app/app.component.css (0 bytes)
CREATE testmod/src/app/app.component.html (1141 bytes)
CREATE testmod/src/app/app.component.spec.ts (990 bytes)
CREATE testmod/src/app/app.component.ts (207 bytes)
CREATE testmod/e2e/protractor.conf.js (752 bytes)
CREATE testmod/e2e/src/app.e2e-spec.ts (299 bytes)
CREATE testmod/e2e/src/app.po.ts (208 bytes)
CREATE testmod/e2e/tsconfig.e2e.json (213 bytes)
npm WARN deprecated [email protected]: 1.2.0 should have been a major version bump
events.js:165░░░░░░⸩ ⠸ extract:kind-of: sill extract [email protected]
      throw er; // Unhandled 'error' event
      ^

Error [ERR_STREAM_WRITE_AFTER_END]: write after end
    at writeAfterEnd (_stream_writable.js:241:12)
    at PassThrough.Writable.write (_stream_writable.js:291:5)
    at PassThrough.Writable.end (_stream_writable.js:576:10)
    at ReadEntry.entry.on (/Users/John/.nvm/versions/node/v9.11.1/lib/node_modules/npm/node_modules/pacote/lib/extract-stream.js:19:41)
    at ReadEntry.emit (events.js:185:15)
    at ReadEntry.emit (/Users/John/.nvm/versions/node/v9.11.1/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:296:25)
    at ReadEntry.[maybeEmitEnd] (/Users/John/.nvm/versions/node/v9.11.1/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:249:12)
    at ReadEntry.end (/Users/John/.nvm/versions/node/v9.11.1/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:162:27)
    at Unpack.[consumeBody] (/Users/John/.nvm/versions/node/v9.11.1/lib/node_modules/npm/node_modules/tar/lib/parse.js:210:13)
    at Unpack.[consumeChunkSub] (/Users/John/.nvm/versions/node/v9.11.1/lib/node_modules/npm/node_modules/tar/lib/parse.js:391:40)
    at Unpack.[consumeChunk] (/Users/John/.nvm/versions/node/v9.11.1/lib/node_modules/npm/node_modules/tar/lib/parse.js:362:30)
    at Unzip.(anonymous function).on.chunk (/Users/John/.nvm/versions/node/v9.11.1/lib/node_modules/npm/node_modules/tar/lib/parse.js:291:59)
    at Unzip.emit (events.js:180:13)
    at Unzip.emit (/Users/John/.nvm/versions/node/v9.11.1/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:296:25)
    at Unzip.write (/Users/John/.nvm/versions/node/v9.11.1/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:99:17)
    at Unzip.write (/Users/John/.nvm/versions/node/v9.11.1/lib/node_modules/npm/node_modules/tar/node_modules/minizlib/index.js:284:29)
Emitted 'error' event at:
    at writeAfterEnd (_stream_writable.js:243:10)
    at PassThrough.Writable.write (_stream_writable.js:291:5)
    [... lines matching original stack trace ...]
    at Unzip.write (/Users/John/.nvm/versions/node/v9.11.1/lib/node_modules/npm/node_modules/tar/node_modules/minizlib/index.js:284:29)
events.js:165░░░░░░⸩ ⠸ extract:electron-to-chromium: sill extract [email protected]
      throw er; // Unhandled 'error' event
      ^

Error [ERR_STREAM_WRITE_AFTER_END]: write after end
    at writeAfterEnd (_stream_writable.js:241:12)
    at PassThrough.Writable.write (_stream_writable.js:291:5)
    at PassThrough.Writable.end (_stream_writable.js:576:10)
    at ReadEntry.entry.on (/Users/John/.nvm/versions/node/v9.11.1/lib/node_modules/npm/node_modules/pacote/lib/extract-stream.js:19:41)
    at ReadEntry.emit (events.js:185:15)
    at ReadEntry.emit (/Users/John/.nvm/versions/node/v9.11.1/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:296:25)
    at ReadEntry.[maybeEmitEnd] (/Users/John/.nvm/versions/node/v9.11.1/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:249:12)
    at ReadEntry.end (/Users/John/.nvm/versions/node/v9.11.1/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:162:27)
    at Unpack.[consumeBody] (/Users/John/.nvm/versions/node/v9.11.1/lib/node_modules/npm/node_modules/tar/lib/parse.js:210:13)
    at Unpack.[consumeChunkSub] (/Users/John/.nvm/versions/node/v9.11.1/lib/node_modules/npm/node_modules/tar/lib/parse.js:391:40)
    at Unpack.[consumeChunk] (/Users/John/.nvm/versions/node/v9.11.1/lib/node_modules/npm/node_modules/tar/lib/parse.js:362:30)
    at Unzip.(anonymous function).on.chunk (/Users/John/.nvm/versions/node/v9.11.1/lib/node_modules/npm/node_modules/tar/lib/parse.js:291:59)
    at Unzip.emit (events.js:180:13)
    at Unzip.emit (/Users/John/.nvm/versions/node/v9.11.1/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:296:25)
    at Unzip.write (/Users/John/.nvm/versions/node/v9.11.1/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:99:17)
    at Unzip.write (/Users/John/.nvm/versions/node/v9.11.1/lib/node_modules/npm/node_modules/tar/node_modules/minizlib/index.js:284:29)
Emitted 'error' event at:
    at writeAfterEnd (_stream_writable.js:243:10)
    at PassThrough.Writable.write (_stream_writable.js:291:5)
    [... lines matching original stack trace ...]
    at Unzip.write (/Users/John/.nvm/versions/node/v9.11.1/lib/node_modules/npm/node_modules/tar/node_modules/minizlib/index.js:284:29)
WARN tar ENOENT: no such file or directory, open '/Users/John/Projects/testmod/node_modules/.staging/caniuse-lite-484fea49/data/regions/NR.js'
WARN tar ENOENT: no such file or directory, open '/Users/John/Projects/testmod/node_modules/.staging/caniuse-lite-484fea49/data/regions/NU.js'
WARN tar ENOENT: no such file or directory, open '/Users/John/Projects/testmod/node_modules/.staging/caniuse-lite-484fea49/data/regions/NZ.js'
WARN tar ENOENT: no such file or directory, open '/Users/John/Projects/testmod/node_modules/.staging/caniuse-lite-484fea49/data/regions/OM.js'
WARN tar ENOENT: no such file or directory, open '/Users/John/Projects/testmod/node_modules/.staging/caniuse-lite-484fea49/data/regions/PA.js'
WARN tar ENOENT: no such file or directory, open '/Users/John/Projects/testmod/node_modules/.staging/caniuse-lite-484fea49/data/regions/PE.js'
WARN tar ENOENT: no such file or directory, open '/Users/John/Projects/testmod/node_modules/.staging/caniuse-lite-484fea49/data/regions/PF.js'
npm ERR! cancel after 1 retries!
WARN tar ENOENT: no such file or directory, open '/Users/John/Projects/testmod/node_modules/.staging/@angular/core-f8dc8deb/fesm5/core.js.map'
WARN tar ENOENT: no such file or directory, open '/Users/John/Projects/testmod/node_modules/.staging/@angular/compiler-afedc52c/esm5/src/template_parser/template_ast.js'

Desired functionality

For NG new to successfully build, or steps for how to fix this problem with a workaround.

Mention any other details that might be useful

johren02 avatar Jul 08 '18 18:07 johren02

This seems like a problem with node/npm and not with Angular CLI.

Please have a look at the fixing npm permissions page, common errors page, npm issue tracker, or open a new issue in that issue tracker if the problem you are experiencing isn't known.

clydin avatar Jul 09 '18 13:07 clydin

I am facing a similar issue on Mac

CREATE front/src/tsconfig.spec.json (282 bytes) CREATE front/src/tslint.json (314 bytes) CREATE front/src/app/app-routing.module.ts (245 bytes) CREATE front/src/app/app.module.ts (393 bytes) CREATE front/src/app/app.component.scss (0 bytes) CREATE front/src/app/app.component.html (1173 bytes) CREATE front/src/app/app.component.spec.ts (1105 bytes) CREATE front/src/app/app.component.ts (208 bytes) CREATE front/e2e/protractor.conf.js (752 bytes) CREATE front/e2e/src/app.e2e-spec.ts (301 bytes) CREATE front/e2e/src/app.po.ts (208 bytes) CREATE front/e2e/tsconfig.e2e.json (213 bytes) npm WARN deprecated [email protected]: 1.2.0 should have been a major version bump ⸨ ░░░░░░⸩ ⠦ extract:typescript: sill extract [email protected]

abbas-v1 avatar Jul 14 '18 15:07 abbas-v1

I was having the same issue on Node 8.11.4 with NPM 5.7.1 when attempting ng new

Solution was to downgrade NPM to 5.6.0 as described in this thread: https://github.com/npm/npm/issues/19989

As of this writing, later versions may work, but haven't tested.

JohnM-729 avatar Sep 08 '18 06:09 JohnM-729

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.