【发布时间】:2021-11-18 20:51:35
【问题描述】:
我正在使用“Angular: 10.0.14”和“@angular/material 10.2.7”,在尝试导入 MatIconRegistry 时出现此错误。
node_modules/@angular/material/icon/icon-registry.d.ts:51:22 中的错误 - 错误 NG6002:出现在 MaterialModule 的 NgModule.imports 中,但无法解析为 NgModule 类。
This likely means that the library (@angular/material/icon) which declares MatIconRegistry 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.
51 export declare class MatIconRegistry implements OnDestroy {
~~~~~~~~~~~~~~~
node_modules/@angular/material/icon/icon-registry.d.ts:51:22 - error NG6003: Appears in the NgModule.exports of MaterialModule, but could not be resolved to an NgModule, Component, Directive, or Pipe class.
This likely means that the library (@angular/material/icon) which declares MatIconRegistry 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.
51 export declare class MatIconRegistry implements OnDestroy {
~~~~~~~~~~~~~~~
src/app/material/material.module.ts:54:14 - error NG6002: Appears in the NgModule.imports of FoodTypeModule, but itself has errors
54 export class MaterialModule { }
~~~~~~~~~~~~~~
src/app/material/material.module.ts:54:14 - error NG6002: Appears in the NgModule.imports of FoodItemModule, but itself has errors
540m export class MaterialModule { }
~~~~~~~~~~~~~~
src/app/material/material.module.ts:54:14 - error NG6002: Appears in the NgModule.imports of IngredientTypeModule, but itself has errors
54 export class MaterialModule { }
~~~~~~~~~~~~~~
src/app/material/material.module.ts:54:14 - error NG6002: Appears in the NgModule.imports of IngredientModule, but itself has errors
54 export class MaterialModule { }
~~~~~~~~~~~~~~
src/app/food-item/food-item.module.ts:24:14 - error NG6002: Appears in the NgModule.imports of AppModule, but itself has errors
24 export class FoodItemModule {}
~~~~~~~~~~~~~~
src/app/food-type/food-type.module.ts:25:14 - error NG6002: Appears in the NgModule.imports of AppModule, but itself has errors
25 export class FoodTypeModule {}
~~~~~~~~~~~~~~
src/app/ingredient/ingredient.module.ts:25:14 - error NG6002: Appears in the NgModule.imports of AppModule, but itself has errors
25 export class IngredientModule {}
~~~~~~~~~~~~~~~~
src/app/ingredient-type/ingredient-type.module.ts:25:14 - error NG6002: Appears in the NgModule.imports of AppModule, but itself has errors
25 export class IngredientTypeModule {}
~~~~~~~~~~~~~~~~~~~~
src/app/material/material.module.ts:54:14 - error NG6002: Appears in the NgModule.imports of AppModule, but itself has errors
54 export class MaterialModule { }
~~~~~~~~~~~~~~
src/app/material/material.module.ts:54:14 - error NG6003: Appears in the NgModule.exports of AppModule, but itself has errors
54 export class MaterialModule { }
【问题讨论】:
标签: angular angular-material mat-icon