angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Error generating a component in a new project with Angular CLI 1.6.5

Open adrianojosue opened this issue 8 years ago • 6 comments

I created a new project with Angular CLI 1.6.5 and when generating a component it sends me the following error: 'Error: More than one module matches. Use skip-import option to skip importing the component into the closest module. More than one module matches. Use skip-import option to skip importing the component into the closest module.' Some help?

adrianojosue avatar Jan 22 '18 18:01 adrianojosue

You have multiple NgModule in the same directory. You can either skip the importation part of the generation by using --skip-import, or you can specify which one to use using the --module= followed by the path to the module you want to import the component.

hansl avatar Jan 23 '18 00:01 hansl

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

Insert component in to specific module ng generate component --module e.g ng generate component test --module app

hardikbhavsar61 avatar Apr 06 '18 18:04 hardikbhavsar61

ng g c name --skip-import

ganpatipaswan avatar Jun 25 '18 21:06 ganpatipaswan

I fixed adding "src" to root config, that it was empty,

angular.json

"projectname-e2e": {
  "root": "src",
  "sourceRoot": "e2e",
}

ricardofilho6 avatar Jul 02 '18 12:07 ricardofilho6

I am getting error, could you please help me. PS D:\I-AAA\Projects\Giribabu\IAAAtech\Projects\New folder\web_cc_purchased\src\app> ng g component giri-ui Your global Angular CLI version (7.3.0) is greater than your local version (7.0.6). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false". Two or more projects are using identical roots. Unable to determine project using current working directory. Using default workspace project instead. More than one module matches. Use skip-import option to skip importing the component into the closest module.

nagipogu avatar Feb 11 '19 06:02 nagipogu

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.