Angular-cli: Error generating a component in a new project with Angular CLI 1.6.5

Created on 22 Jan 2018  路  6Comments  路  Source: angular/angular-cli

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?

Most helpful comment

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.

All 6 comments

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.

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

ng g c name --skip-import

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

angular.json

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

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.

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NCC1701M picture NCC1701M  路  3Comments

brtnshrdr picture brtnshrdr  路  3Comments

MateenKadwaikar picture MateenKadwaikar  路  3Comments

purushottamjha picture purushottamjha  路  3Comments

gotschmarcel picture gotschmarcel  路  3Comments