首页 > 解决方案 > Angular 9 和 Ivy 的运行时错误:无法读取未定义的属性“id”;区

问题描述

我们有一个带有测试的 Angular 8 项目。我们正在尝试升级到 Angular 9,并完成了https://update.angular.io/#8.0:9.0l3中的所有步骤。这一切都很顺利,没有任何问题。该应用程序编译没有错误,所有测试都运行良好。我们在运行时收到此错误。当我们关闭 Ivy 时,它运行良好,所以看起来肯定与 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)

标签: angularangular9

解决方案


我尝试ng build --prod为我的 Angular 应用程序运行构建。它清楚地告诉我我有什么问题。您可以尝试一下以了解您需要解决的问题。


推荐阅读