We have an Angular 8 project with tests. We are attempting to upgrade to Angular 9 and went through all the steps in https://update.angular.io/#8.0:9.0l3. This all went smoothly, no issues. The app compiles with no errors and all of the tests run fine. We are getting this error at runtime. When we turn off Ivy, it runs fine so definitely seems related to Ivy.
zone-evergreen.js:659 Unhandled Promise rejection: Cannot read property 'id' of undefined ; Zone: <root> ; Task: Promise.then ; Value: TypeError: Cannot read property 'id' of undefined
at registerNgModuleType (core.js:35467)
at core.js:35485
at Array.forEach (<anonymous>)
at registerNgModuleType (core.js:35481)
at core.js:35485
at Array.forEach (<anonymous>)
at registerNgModuleType (core.js:35481)
at new NgModuleFactory$1 (core.js:35649)
at compileNgModuleFactory__POST_R3__ (core.js:41403)
at PlatformRef.bootstrapModule (core.js:41768) TypeError: Cannot read property 'id' of undefined
at registerNgModuleType (http://localhost:8080/vendor.js:41436:27)
at http://localhost:8080/vendor.js:41454:14
at Array.forEach (<anonymous>)
at registerNgModuleType (http://localhost:8080/vendor.js:41450:17)
at http://localhost:8080/vendor.js:41454:14
at Array.forEach (<anonymous>)
at registerNgModuleType (http://localhost:8080/vendor.js:41450:17)
at new NgModuleFactory$1 (http://localhost:8080/vendor.js:41602:13)
at compileNgModuleFactory__POST_R3__ (http://localhost:8080/vendor.js:46530:27)
at PlatformRef.bootstrapModule (http://localhost:8080/vendor.js:46859:16)
I try to run build ng build --prod
for my Angular app. And it clear show me what problem i have.You can try it to know what you need to fix.
I was finally able to track down the error. I had to comment out all the imported modules in app.component.ts
, app.module.ts
and shared.module.ts
and add each module back one at a time. I finally narrowed it down to the include of angular2-recaptcha
. That was including a module called ReCaptchaModule
. I'm currently researching how to upgrade or replace that.
Hopefully this is a good troubleshooting tip to others out there.
try and add "enableIvy": true
in ts.config
under "angularCompilerOptions"
& run ng serve
it would give you a more precise description about the error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With