MatToolbar throws error when using it with Angular 9

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

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

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


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.