1

I am trying to run simple component generate command which is throwing error like this:

command:

sudo ng generate component forgot-pass

Error Msg:

Path "/src/app/forgot-pass/forgot-pass.component.css" already exist.

I am clueless about this error, my application is building properly and when check there is not a single folder or file like this.

If I put anything istead of forgot-pass, it throws the same error.

FYI, here is the version my cli is using:

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


Angular CLI: 6.0.1
Node: 8.11.2
OS: darwin x64
Angular: 6.0.2
... common, compiler, compiler-cli, core, forms, http
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.6.1
@angular-devkit/build-angular     0.6.1
@angular-devkit/build-optimizer   0.6.1
@angular-devkit/core              0.6.1
@angular-devkit/schematics        0.6.1
@angular/animations               6.1.2
@angular/cli                      6.0.1
@ngtools/webpack                  6.0.1
@schematics/angular               0.6.1
@schematics/update                0.6.1
rxjs                              6.2.0
typescript                        2.7.2
webpack                           4.6.0
Jay
  • 524
  • 1
  • 7
  • 21

1 Answers1

2

This seems to be a known issue with that version of angular cli due to some files were created twice. probably what you can do is to create a new app.

You can resolve this by updating your angular cli version sudo npm update @angular/cli latest

Sajeetharan
  • 216,225
  • 63
  • 350
  • 396
  • My project grown a bit big I can't do with new project, can I update angular CLI instead? – Jay Oct 06 '18 at 06:42
  • [how-to-upgrade-angular-cli-to-the-latest-version](https://stackoverflow.com/questions/43931986/how-to-upgrade-angular-cli-to-the-latest-version) – HDJEMAI Oct 06 '18 at 06:44
  • Please edit the answer as alternate to this. I did sudo npm update @angular/cli latest and that worked for me – Jay Oct 06 '18 at 06:47
  • thats what i already mentioned in the answer. anyway i will update – Sajeetharan Oct 06 '18 at 06:51