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

        今天用ng-cli了一个新的angular项目,并不想在src/app下新建子模块,于是新建了src/page路径,并在路径下执行ng g component test命令,然后报错

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

        原因是命令构建的component,无法找到上级模块的module,解决的办法就是直接在src/app下执行ng g component test命令,然后上级模块也就是app的app.module.ts文件自动会引入该test组件


Could not find an NgModule. Use the skip-import option to skip importing in NgModule._第1张图片

你可能感兴趣的:(Could not find an NgModule. Use the skip-import option to skip importing in NgModule.)