Angular 6 CLI Component & Service Generate Issue

Most of the developers these days are using Angular as their front-end to build Single Page Application, so do I.  This is not new that every Angular update comes with some minor changes and updating your existing project to the latest definitely affect your project.  Today, I tried to upgrade my Angular 4 project to Angular 6 and so far it all looked good, no issues!

But strange thing happened, when I tried to generate a new component using the following command

ng g c signup –module app.module

ERROR:

Specified module does not exist

Tried 2nd command

ng g c signup –module

ERROR:

could not find an ngmodule. use the skip-import option to skip importing in
ngmodule.

Tried 3rd command

ng g c signup –module –skip-import

Now, there was no error but the component was generated in e2e folder instead of my app folder.

How did I fix it?

In the angular.json file, I searched for:

my-project-e2e

Replace my-project with your project name.

Changed:

      “root”: “” to  “root”: “e2e”

Just saved it and everything was fine again!