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。

原文地址:https://www.cnblogs.com/hiwynn/p/10875804.html