Could not find an NgModule. Use the skip-import option to skip importing in NgModule.

使用  ng generate component sticky-table  命令新建一个组件时报错:Could not find an NgModule. Use the skip-import option to skip importing in NgModule.

 

原因是无法找到上级模块的 module(module 的名字不是 app.module.ts);

 

解决办法:指定 module 即可, ng generate component sticky-table --module=main ,我这里 module 的名字是 main.ts。

 

posted @ 2019-05-16 15:15  hiwynn  阅读(2640)  评论(0编辑  收藏  举报