运行
ng generate component hello
命令出现下面问题
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.
根据提示再次运行
ng generate component hello --module=app.module
然后出现错误
Error: Specified module does not exist
Specified module does not exist
试了多种方法都找不出问题所有
后来发现原来自己的app有多个.module文件就会导致CLI出错,把多个module合并成一个解决问题
本文介绍了一种常见的Angular CLI问题,即在使用ng generate命令创建组件时遇到的错误:More than one module matches和Specified module does not exist。文章详细说明了问题的原因,并给出了解决方案——合并重复的.module文件。

被折叠的 条评论
为什么被折叠?



