title: Angular 9 or 10 + Angular Material 10: import could not be resolved to an NgModule class
body: <p>I did a new project with Angular 9 and last version of material. When I imported some Material's classes, I had this error:</p>
  <blockquote>
  <p>ERROR in node_modules/@angular/material/form-field/label.d.ts:10:22 - error NG6002: Appears in the NgModule.imports of MaterialModule, but could not be resolved to an NgModule class.</p>
  <p>This likely means that the library (@angular/material/form-field) which declares MatLabel 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.</p>
  <p>10 export declare class MatLabel {
  ~~~~~~~~
  node_modules/@angular/material/form-field/hint.d.ts:20:22 - error NG6002: Appears in the NgModule.imports of MaterialModule, but could not be resolved to an NgModule class.</p>
  <p>This likely means that the library (@angular/material/form-field) which declares MatHint 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.</p>
  <p>20 export declare class MatHint {
  ~~~~~~~
  src/app/material.module.ts:12:14 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.</p>
  <p>Is it missing an @NgModule annotation?</p>
  <p>12 export class MaterialModule {}
  ~~~~~~~~~~~~~~</p>
  <p>ERROR in node_modules/@angular/material/form-field/label.d.ts:10:22 - error NG6002: Appears in the NgModule.imports of MaterialModule, but could not be resolved to an NgModule class.</p>
  <p>This likely means that the library (@angular/material/form-field) which declares MatLabel 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.</p>
  <p>10 export declare class MatLabel {
  ~~~~~~~~
  node_modules/@angular/material/form-field/hint.d.ts:20:22 - error NG6002: Appears in the NgModule.imports of MaterialModule, but could not be resolved to an NgModule class.</p>
  <p>This likely means that the library (@angular/material/form-field) which declares MatHint 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.</p>
  <p>20 export declare class MatHint {
  ~~~~~~~
  src/app/material.module.ts:12:14 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class.</p>
  <p>Is it missing an @NgModule annotation?</p>
  <p>12 export class MaterialModule {}
  ~~~~~~~~~~~~~~</p>
  </blockquote>
  <p><strong>material.module.ts</strong></p>
  <pre><code>import { NgModule } from '@angular/core';
  import {
    MatFormFieldModule,
    MatLabel,
    MatHint,
  } from '@angular/material/form-field';
  
  @NgModule({
    imports: [MatFormFieldModule, MatLabel, MatHint],
    exports: [MatFormFieldModule, MatLabel, MatHint],
  })
  export class MaterialModule {}
  
  </code></pre>
  <p><strong>app.modules.ts</strong></p>
  <pre><code>import { BrowserModule } from '@angular/platform-browser';
  import { NgModule } from '@angular/core';
  import { FormsModule, ReactiveFormsModule } from '@angular/forms';
  
  import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
  
  import { MaterialModule } from './material.module';
  
  import { AppRoutingModule } from './app-routing.module';
  import { AppComponent } from './app.component';
  import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
  import { CarouselComponent } from './carousel/carousel.component';
  import { DashboardComponent } from './dashboard/dashboard.component';
  import { CrudComponent } from './crud/crud.component';
  import { ProfileComponent } from './profile/profile.component';
  import { LayoutComponent } from './layout/layout.component';
  import { FooterComponent } from './layout/footer/footer.component';
  import { HomeComponent } from './home/home.component';
  import { AboutComponent } from './about/about.component';
  import { LoginComponent } from './login/login.component';
  import { PrivHeaderComponent } from './layout/priv-header/priv-header.component';
  import { PrivMenuComponent } from './layout/priv-menu/priv-menu.component';
  import { MainMenuComponent } from './layout/main-menu/main-menu.component';
  import { MainHeaderComponent } from './layout/main-header/main-header.component';
  
  @NgModule({
    declarations: [
      AppComponent,
      CarouselComponent,
      DashboardComponent,
      CrudComponent,
      ProfileComponent,
      LayoutComponent,
      FooterComponent,
      HomeComponent,
      AboutComponent,
      LoginComponent,
      PrivHeaderComponent,
      PrivMenuComponent,
      MainMenuComponent,
      MainHeaderComponent,
    ],
    imports: [
      BrowserModule,
      FormsModule,
      MaterialModule,
      ReactiveFormsModule,
      AppRoutingModule,
      BrowserAnimationsModule,
    ],
    providers: [],
    bootstrap: [AppComponent],
    schemas: [CUSTOM_ELEMENTS_SCHEMA],
  })
  export class AppModule {}
  
  </code></pre>
  <p><strong>package.json</strong></p>
  <pre><code>{
    &quot;name&quot;: &quot;mini-aplicacion&quot;,
    &quot;version&quot;: &quot;0.0.0&quot;,
    &quot;scripts&quot;: {
      &quot;ng&quot;: &quot;ng&quot;,
      &quot;start&quot;: &quot;ng serve&quot;,
      &quot;build&quot;: &quot;ng build&quot;,
      &quot;test&quot;: &quot;ng test&quot;,
      &quot;lint&quot;: &quot;ng lint&quot;,
      &quot;e2e&quot;: &quot;ng e2e&quot;
    },
    &quot;private&quot;: true,
    &quot;dependencies&quot;: {
      &quot;@angular/animations&quot;: &quot;~10.0.5&quot;,
      &quot;@angular/cdk&quot;: &quot;^10.1.0&quot;,
      &quot;@angular/common&quot;: &quot;~10.0.5&quot;,
      &quot;@angular/compiler&quot;: &quot;~10.0.5&quot;,
      &quot;@angular/core&quot;: &quot;~10.0.5&quot;,
      &quot;@angular/forms&quot;: &quot;~10.0.5&quot;,
      &quot;@angular/material&quot;: &quot;^10.1.0&quot;,
      &quot;@angular/platform-browser&quot;: &quot;~10.0.5&quot;,
      &quot;@angular/platform-browser-dynamic&quot;: &quot;~10.0.5&quot;,
      &quot;@angular/router&quot;: &quot;~10.0.5&quot;,
      &quot;rxjs&quot;: &quot;~6.5.4&quot;,
      &quot;tslib&quot;: &quot;^2.0.0&quot;,
      &quot;zone.js&quot;: &quot;~0.10.2&quot;
    },
    &quot;devDependencies&quot;: {
      &quot;@angular-devkit/build-angular&quot;: &quot;~0.1000.4&quot;,
      &quot;@angular/cli&quot;: &quot;~10.0.4&quot;,
      &quot;@angular/compiler-cli&quot;: &quot;~10.0.5&quot;,
      &quot;@types/node&quot;: &quot;^12.11.1&quot;,
      &quot;@types/jasmine&quot;: &quot;~3.5.0&quot;,
      &quot;@types/jasminewd2&quot;: &quot;~2.0.3&quot;,
      &quot;codelyzer&quot;: &quot;^6.0.0&quot;,
      &quot;jasmine-core&quot;: &quot;~3.5.0&quot;,
      &quot;jasmine-spec-reporter&quot;: &quot;~5.0.0&quot;,
      &quot;karma&quot;: &quot;~5.0.0&quot;,
      &quot;karma-chrome-launcher&quot;: &quot;~3.1.0&quot;,
      &quot;karma-coverage-istanbul-reporter&quot;: &quot;~3.0.2&quot;,
      &quot;karma-jasmine&quot;: &quot;~3.3.0&quot;,
      &quot;karma-jasmine-html-reporter&quot;: &quot;^1.5.0&quot;,
      &quot;protractor&quot;: &quot;~7.0.0&quot;,
      &quot;ts-node&quot;: &quot;~8.3.0&quot;,
      &quot;tslint&quot;: &quot;~6.1.0&quot;,
      &quot;typescript&quot;: &quot;~3.9.7&quot;
    }
  }
  </code></pre>
  <p>I tried to delete node_modules and install it again. Also, I update Angular version to 10 and Material version, but the problem persisted.</p>
  <p>I review other similar issues, but non of the solutions fix my problem.</p>