Uncaught TypeError: Cannot read property 'id' of undefined at registerNgModuleType - angular PWA
This often happens when you've mixed up imports
and declarations
in the pertinent module (or some other such mix-up).
You might for example have put a component in the imports
array, where only modules should be 'declared'.
The component should be in the declarations
array.
In my case this error occurred seemingly at random. One moment it was working, and the next moment it wasn't. Known working commits were also broken.
I had to delete node_modules
and reinstall them which fixed the problem.
In my case, I was running Angular 8 and my project suddenly stoped working (I assumed after a VS code update v 1.56.2)
I resolved this issue by deactivating a VS Code extension called Angular Language Service
and deleting the node_modules folder.
Then i run npm install
and my project is working since.
My package json dependencies
{..."dependencies": { "@angular/animations": "8.2.14", "@angular/cdk": "~8.2.3", "@angular/common": "8.2.14", "@angular/compiler": "8.2.14", "@angular/core": "8.2.14", "@angular/forms": "8.2.14", "@angular/http": "7.2.15", "@angular/platform-browser": "8.2.14", "@angular/platform-browser-dynamic": "8.2.14", "@angular/router": "8.2.14", "@microsoft/applicationinsights-web": "~2.5.5", "@ng-bootstrap/ng-bootstrap": "5.0.0", "@ngx-translate/core": "^11.0.1", "@ngx-translate/http-loader": "^4.0.0", "angular-archwizard": "^4.0.0", "animate.css": "^3.7.2", "bootstrap": "4.4.1", "chart.js": "2.8.0", "core-js": "3.5.0", "crypto-js": "^4.0.0", "file-saver": "2.0.2", "flag-icon-css": "^3.4.5", "moment": "2.24.0", "ng2-charts": "2.3.0", "ng2-validation": "^4.2.0", "ngx-mask": "^8.1.6", "ngx-progressbar": "2.1.1", "oidc-client": "1.10.1", "popper": "1.0.1", "rxjs": "6.5.3", "rxjs-compat": "6.5.3", "tslib": "1.10.0", "zone.js": "0.10.2" },}