Angular Specified module does not exist adding component

Error while adding any component in Angular:

Specified module ..Module does not exist.
Looked in the following directories....

Let’s the anme of your module is HelloFoo and the fill name of the module is hello-foo.module then you need to use this command:

ng generate c <YourComponentName> --module hello-foo.module

instead of this:

ng generate c <YourComponentName> --module HelloFooModule

You will be able to add your component after that.