find and solve || findandsolve.com
Please wait.....

module matches. Use the skip-import option to skip importing the component into the closest module or use the module opt

module matches. Use the skip-import option to skip importing the component into the closest module or use the module opt

More than one module matches. Use the skip-import option to skip importing the component into the closest module or use the module option to specify a module.

Answer

Solution 1

The Specify module using "module parameter". For example, if the main module is app.module.ts, run this:

ng g c new-component --module app

Or

other directory then

ng g c component-name --module ../
Solution 2

It is working fine in my case.

ng generate component <componentName> --module=app.module
Solution 3
ng g component component-name --skip-import
Solution 4

When I have trying to create new component under a folder I was getting below error.

error: More than one module matches. Use skip-import option to skip importing the component into the closest module.

I have create new component  successfully under a folder by given below command line

 ng g c folderName/<your_newComponent> ---module ../app
Some of “ng g component” Code Answer  as give below
ng generate class hero --type=model
ng g c componentName
ng generate <schematic> [options]
ng g class <name> [options]

If you want to create new component without .spec file, you can use

ng g c component-name --spec false

you can use ng --help, ng g --help or ng g c --help for the docs


Sundar  Neupane

Sundar Neupane

I like working on projects with a team that cares about creating beautiful and usable interfaces.

Comments



Report Response