Cannot read property 'ngMetadataName' of undefined Cannot read property 'ngMetadataName' of undefined angular angular

Cannot read property 'ngMetadataName' of undefined


Same message but no relation with Material, I had this error too. I realized, there is a warning about circular dependency. This error disappears after I remove dependencies.

May be other warning messages during compile process will help to fix this.

To see the created circular dependency in your angular project, please enable showCircularDependencies in angular.json by changing its value from false to true.


I encountered this error when I upgraded Angular with the CLI version 8.0.4. I had to downgrade to @angular-devkit/build-angular 0.800.3 and Angular CLI to version 8.0.3.

npm i --save-dev @angular-devkit/build-angular@0.800.3 @angular/cli@8.0.3


I had this error due to having 2 services in 1 file. Moving them to separate files solved the issue.