Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MatToolbar throws error when using it with Angular 9

Angular version 9.2.0

When I import the MatToolbarModule in a module and use it in the html template, then I get the following error message:

This likely means that the library (@angular/material/toolbar) which declares MatToolbarModule 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.

8 export declare class MatToolbarModule {                        ~~~~~~~~~~~~~~~~ src/app/angular-material.module.ts:53:14 - error NG6002: Appears in the NgModule.imports of ComponentsModule, but itself has errors 

Does anyone face the same issue?

like image 955
Ling Vu Avatar asked Apr 07 '20 11:04

Ling Vu


2 Answers

Add below specific configuration in package.json and npm install.

{   "scripts": {     "postinstall": "ngcc"   } } 

Reference: https://angular.io/guide/ivy#speeding-up-ngcc-compilation

like image 143
Rakesh Avatar answered Sep 20 '22 14:09

Rakesh


I had the same problem before, its because you modify your app.module.ts file while the server is running. Try to stop it and then run it again using the ng servecommand.

like image 27
Ramzi Bouchair Avatar answered Sep 17 '22 14:09

Ramzi Bouchair