如何解决使用 FlexLayoutModule 在 Angular 11 中出现错误
我已经安装了 FlexLayoutModule
并在遇到此错误时声明了它:
Error: node_modules/@angular/flex-layout/typings/module.d.ts:16:22 - error NG6002: Appears in the NgModule.imports of AppModule,but could not be resolved to an NgModule class.
This likely means that the library (@angular/flex-layout/typings/module) which declares FlexLayoutModule has not been processed correctly by ngcc,or is not compatible with Angular Ivy. Check if a newer version of the library is available,and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.
16 export declare class FlexLayoutModule {
~~~~~~~~~~~~~~~~
可能有什么问题?
FlexLayoutModule 版本为 11.0.0-beta.33
解决方法
我遇到了同样的问题。我通过导入不是 FlexLayoutModule 而是 FlexModule 来修复它:
import { FlexModule } from '@angular/flex-layout';
那是我的 package.json:
"dependencies": {
"@angular/animations": "~11.0.5","@angular/cdk": "^11.0.3","@angular/common": "~11.0.5","@angular/compiler": "~11.0.5","@angular/core": "~11.0.5","@angular/flex-layout": "^11.0.0-beta.33","@angular/forms": "~11.0.5","@angular/material": "^11.0.3","@angular/platform-browser": "~11.0.5","@angular/platform-browser-dynamic": "~11.0.5","@angular/router": "~11.0.5","rxjs": "~6.6.0","tslib": "^2.0.0","zone.js": "~0.10.2"
},
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。