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

Ish Man picture Ish Man · Sep 12, 2017 · Viewed 319.9k times · Source

When I try to create a component in the angular cli, it's showing me this error. How do I get rid of it ?

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

I'm using angular cli version: 1.4.1

Answer

zisha picture zisha · Sep 13, 2017

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

ng g c new-component --module app

Or if you are in an other directory then

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