I'm trying to create a new Angular component with a very simple command line: "ng generate component MY-COMPONENT". But the error occurs: "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."
I'm using version "11.2.19" of angular CLI
CodePudding user response:
I've seen this error happen when you have more than one "app.module" in the project.
You can try to solve it by adding the option "--skip-import" to the command, like this:
ng generate component MY-COMPONENT --skip-import
But then you will have to add the "import" manually in the app-module