4

I am getting error when i create a Angular 4 app in CLI mode.

I am getting this error

anjan@anjan-HP-Laptop-15-bs0xx:~/Desktop/angular$ ng new a4app
npm ERR! write after end  
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/anjan/.npm/_logs/2018-04-13T04_48_09_522Z-debug.log

Please give me a proper suggestion so that i can solve this problem.

My Angular configuration

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 6.0.0-rc.4
Node: 8.11.1
OS: linux x64
Angular: 
... 

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.5.6
@angular-devkit/core         0.5.6
@angular-devkit/schematics   0.5.6
@ngtools/json-schema         1.1.0
@schematics/angular          0.5.6
@schematics/update           0.5.6
rxjs                         6.0.0-turbo-rc.4
typescript                   2.7.2
Anjan Biswas
  • 701
  • 1
  • 10
  • 23

5 Answers5

4
npm install -g npm@5.6.0

After running this command my problem is solved.

Anjan Biswas
  • 701
  • 1
  • 10
  • 23
  • 1
    Updating npm helped me too. I would suggest running `npm i -g npm` to update npm to latest version instead of keeping the 5.6.0 one. – kcpr Apr 29 '19 at 18:19
3

after running

npm update

my problem was solved

MAYOBYO HASSAN
  • 467
  • 6
  • 10
2

yarn is faster than npm. just install yarn. run the following code

yarn global add @angular/cli

after running this command run, then create your project

ng new a4app

otherwise uninstall npm and then install latest version

npm uninstall --save
npm install -g npm@latest
Alamgir
  • 686
  • 8
  • 14
1

I had similar issue with Angular 6 and the following workaround solved this issue form me,

npm uninstall @angular/cli -g

npm install @angular/cli -g

Also I switched back to LTS version of node form the latest version to be on safer side.

Community
  • 1
  • 1
Karthik P
  • 481
  • 5
  • 9
1
sudo npm uninstall -g angular-cli @angular/cli
npm cache clean --force
sudo npm install -g @angular/cli

Problem is resolved on my mac.

Manish Nahar
  • 834
  • 10
  • 24