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

Error when generate a new Angular project by running command

Open maiibraheem opened this issue 8 years ago • 8 comments

## Versions npm: 5.7.1 Angular CLI: 1.7.3 Node: 6.10.3 OS: win32 x64

## Repro steps

  1. install latest npm
  2. install latest angular-cli
  3. create a new angular project on npm: ng new dns-ng2-app --skip-git

This give following output:

create dns-ng2-app/e2e/app.e2e-spec.ts (293 bytes) create dns-ng2-app/e2e/app.po.ts (208 bytes) create dns-ng2-app/e2e/tsconfig.e2e.json (235 bytes) create dns-ng2-app/karma.conf.js (923 bytes) create dns-ng2-app/package.json (1296 bytes) create dns-ng2-app/protractor.conf.js (722 bytes) create dns-ng2-app/README.md (1025 bytes) create dns-ng2-app/tsconfig.json (363 bytes) create dns-ng2-app/tslint.json (3012 bytes) create dns-ng2-app/.angular-cli.json (1246 bytes) create dns-ng2-app/.editorconfig (245 bytes) create dns-ng2-app/src/assets/.gitkeep (0 bytes) create dns-ng2-app/src/environments/environment.prod.ts (51 bytes) create dns-ng2-app/src/environments/environment.ts (387 bytes) create dns-ng2-app/src/favicon.ico (5430 bytes) create dns-ng2-app/src/index.html (296 bytes) create dns-ng2-app/src/main.ts (370 bytes) create dns-ng2-app/src/polyfills.ts (3114 bytes) create dns-ng2-app/src/styles.css (80 bytes) create dns-ng2-app/src/test.ts (642 bytes) create dns-ng2-app/src/tsconfig.app.json (211 bytes) create dns-ng2-app/src/tsconfig.spec.json (283 bytes) create dns-ng2-app/src/typings.d.ts (104 bytes) create dns-ng2-app/src/app/app.module.ts (316 bytes) create dns-ng2-app/src/app/app.component.html (1141 bytes) create dns-ng2-app/src/app/app.component.spec.ts (986 bytes) create dns-ng2-app/src/app/app.component.ts (207 bytes) create dns-ng2-app/src/app/app.component.css (0 bytes) npm WARN deprecated [email protected]: All versions below 4.0.1 of Nodemailer are deprecated. See https://nodemailer.com/status/ npm WARN deprecated [email protected]: This project is unmaintained npm WARN deprecated [email protected]: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0 npm WARN deprecated [email protected]: This project is unmaintained npm WARN deprecated [email protected]: Use uuid module instead npm WARN deprecated [email protected]: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0 npm ERR! write after end

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\mibraheem\AppData\Roaming\npm-cache_logs\2018-03-20T15_18_39_801Z-debug.log Error: Package install failed, see above. Package install failed, see above.

## Observed behavior The directory was created as well as project structure inside it but index.ts was not created in src>app folder

and when running $ ng serve I revive the next error node_modules appears empty, you may need to run npm install

## Desired behavior Be able to implement a new Angular 2 project form scratch by CLI

maiibraheem avatar Mar 20 '18 16:03 maiibraheem

In hopes that this may help, I just had a similar issue on Mac OSX. I was trying to sort out another issue (about deprecated packages #10023), and so I ran npm cache clear --force. That seemed to produce the same error as @maiibraheem encountered, but below actually has a stack trace for diagnosis:

$ npm cache clear --force npm WARN using --force I sure hope you know what you are doing. $ rm -R sb-app $ ng new sb-app create sb-app/README.md (1021 bytes) create sb-app/.angular-cli.json (1241 bytes) create sb-app/.editorconfig (245 bytes) create sb-app/.gitignore (544 bytes) create sb-app/src/assets/.gitkeep (0 bytes) create sb-app/src/environments/environment.prod.ts (51 bytes) create sb-app/src/environments/environment.ts (387 bytes) create sb-app/src/favicon.ico (5430 bytes) create sb-app/src/index.html (292 bytes) create sb-app/src/main.ts (370 bytes) create sb-app/src/polyfills.ts (3114 bytes) create sb-app/src/styles.css (80 bytes) create sb-app/src/test.ts (642 bytes) create sb-app/src/tsconfig.app.json (211 bytes) create sb-app/src/tsconfig.spec.json (283 bytes) create sb-app/src/typings.d.ts (104 bytes) create sb-app/e2e/app.e2e-spec.ts (288 bytes) create sb-app/e2e/app.po.ts (208 bytes) create sb-app/e2e/tsconfig.e2e.json (235 bytes) create sb-app/karma.conf.js (923 bytes) create sb-app/package.json (1291 bytes) create sb-app/protractor.conf.js (722 bytes) create sb-app/tsconfig.json (363 bytes) create sb-app/tslint.json (3012 bytes) create sb-app/src/app/app.module.ts (316 bytes) create sb-app/src/app/app.component.css (0 bytes) create sb-app/src/app/app.component.html (1141 bytes) create sb-app/src/app/app.component.spec.ts (986 bytes) create sb-app/src/app/app.component.ts (207 bytes) npm WARN deprecated [email protected]: All versions below 4.0.1 of Nodemailer are deprecated. See https://nodemailer.com/status/ npm WARN deprecated [email protected]: This project is unmaintained npm WARN deprecated [email protected]: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0 npm WARN deprecated [email protected]: Use uuid module instead npm WARN deprecated [email protected]: This project is unmaintained npm WARN deprecated [email protected]: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0 events.js:183░░░░░░⸩ ⠇ extract:source-map: sill extract [email protected] throw er; // Unhandled 'error' event ^

Error: write after end at writeAfterEnd (_stream_writable.js:236:12) at PassThrough.Writable.write (_stream_writable.js:287:5) at PassThrough.Writable.end (_stream_writable.js:563:10) at ReadEntry.entry.on (/Users/lev/npm/lib/node_modules/npm/node_modules/pacote/lib/extract-stream.js:19:41) at emitOne (events.js:121:20) at ReadEntry.emit (events.js:211:7) at ReadEntry.emit (/Users/lev/npm/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:287:25) at ReadEntry.[maybeEmitEnd] (/Users/lev/npm/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:240:12) at ReadEntry.end (/Users/lev/npm/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:153:27) at Unpack.[consumeBody] (/Users/lev/npm/lib/node_modules/npm/node_modules/tar/lib/parse.js:210:13) at Unpack.[consumeChunkSub] (/Users/lev/npm/lib/node_modules/npm/node_modules/tar/lib/parse.js:391:40) at Unpack.[consumeChunk] (/Users/lev/npm/lib/node_modules/npm/node_modules/tar/lib/parse.js:360:30) at Unzip.(anonymous function).on.chunk (/Users/lev/npm/lib/node_modules/npm/node_modules/tar/lib/parse.js:291:59) at emitOne (events.js:116:13) at Unzip.emit (events.js:211:7) at Unzip.emit (/Users/lev/npm/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:287:25) events.js:183░░░░░░⸩ ⠙ extract:underscore: sill extract [email protected] throw er; // Unhandled 'error' event ^

Error: write after end at writeAfterEnd (_stream_writable.js:236:12) at PassThrough.Writable.write (_stream_writable.js:287:5) at PassThrough.Writable.end (_stream_writable.js:563:10) at ReadEntry.entry.on (/Users/lev/npm/lib/node_modules/npm/node_modules/pacote/lib/extract-stream.js:19:41) at emitOne (events.js:121:20) at ReadEntry.emit (events.js:211:7) at ReadEntry.emit (/Users/lev/npm/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:287:25) at ReadEntry.[maybeEmitEnd] (/Users/lev/npm/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:240:12) at ReadEntry.end (/Users/lev/npm/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:153:27) at Unpack.[consumeBody] (/Users/lev/npm/lib/node_modules/npm/node_modules/tar/lib/parse.js:210:13) at Unpack.[consumeChunkSub] (/Users/lev/npm/lib/node_modules/npm/node_modules/tar/lib/parse.js:391:40) at Unpack.[consumeChunk] (/Users/lev/npm/lib/node_modules/npm/node_modules/tar/lib/parse.js:362:30) at Unzip.(anonymous function).on.chunk (/Users/lev/npm/lib/node_modules/npm/node_modules/tar/lib/parse.js:291:59) at emitOne (events.js:116:13) at Unzip.emit (events.js:211:7) at Unzip.emit (/Users/lev/npm/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:287:25) WARN tar ENOENT: no such file or directory, open '/Users/lev/Documents/Code/Projects/solidbase/sb-app/node_modules/.staging/typescript-7b4b6905/lib/typescript.js' WARN tar ENOENT: no such file or directory, open '/Users/lev/Documents/Code/Projects/solidbase/sb-app/node_modules/.staging/uws-5b5d9251/uws_linux_48.node' WARN tar ENOENT: no such file or directory, open '/Users/lev/Documents/Code/Projects/solidbase/sb-app/node_modules/.staging/@angular-devkit/schematics-61e6daea/src/tree/virtual.d.ts' WARN tar ENOENT: no such file or directory, open '/Users/lev/Documents/Code/Projects/solidbase/sb-app/node_modules/.staging/@angular-devkit/schematics-61e6daea/src/tree/virtual.js' WARN tar ENOENT: no such file or directory, open '/Users/lev/Documents/Code/Projects/solidbase/sb-app/node_modules/.staging/typescript-69f0c35f/lib/tsserverlibrary.js' WARN tar ENOENT: no such file or directory, open '/Users/lev/Documents/Code/Projects/solidbase/sb-app/node_modules/.staging/@angular/compiler-69f6f05b/bundles/compiler.umd.js.map' WARN tar ENOENT: no such file or directory, open '/Users/lev/Documents/Code/Projects/solidbase/sb-app/node_modules/.staging/ajv-cf4b9bae/dist/ajv.min.js' npm ERR! cancel after 1 retries! ^C

gimelfarb avatar Mar 30 '18 22:03 gimelfarb

In any case, I worked around it by doing:

$ npm uninstall @angular/cli -g $ npm install @angular/cli -g

After that, the ng new sb-app --skip-git command worked.

I figured I should use --skip-git because of another error that seems to pop up in the end (https://stackoverflow.com/questions/36908041/git-could-not-expand-include-path-gitcinclude-fatal-bad-config-file-line?lq=1). Don't know enough about what 'ng new' does for Git to know, but saw that --skip-git switch exists, which avoids the error.

gimelfarb avatar Mar 30 '18 22:03 gimelfarb

I have the "npm ERR! write after end" error on windows 10 1709, ngcli 6.0.1, node 8.11.1 and npm 6.0.1. But, ngcli work well on macOS latest version. And I never find this error on macOS.

m2nlight avatar May 14 '18 06:05 m2nlight

Had the npm ERR! write after end on a clean install over Windows. Solved after running ng new app on a shorter path.

estebanpanelli avatar Jun 06 '18 22:06 estebanpanelli

Npm version 6.1.0 fixes write after end error. See npm relese notes. All versions between 5.6.0 and 6.1.0 have this problem. See https://github.com/npm/npm/issues/19989

mantyz avatar Jun 06 '18 23:06 mantyz

Downgrade your npm to fix this issue

npm install -g [email protected]

it works...

ghost avatar Sep 15 '18 07:09 ghost

This seems like a problem with your 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.

alan-agius4 avatar Nov 13 '18 09:11 alan-agius4

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.