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

angular

in previous versions i have just been able to generate a new component like this…

ng g c modules/update-tables/containers/users-container

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

then i tried…

ng g c containers/users-container --module=update-tables

Error: Specified module does not exist

then i tried…

ng g c containers/users-container --module UpdateTablesModule

Error: Specified module does not exist

enter image description here

Best Answer

You should specify relative path to your *.module.ts file from /app folder:

ng g c containers/users-container ./modules/update-tables/update-tables/update-tables.module.ts

You can also omit the .module.ts suffix:

ng g c containers/users-container ./modules/update-tables/update-tables/update-tables

It even works without the module name, then it will take the first one in given folder, so it might be better to specify it:

ng g c containers/users-container ./modules/update-tables/update-tables
Related Topic