angular - 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)
解决方案
我尝试ng build --prod
为我的 Angular 应用程序运行构建。它清楚地告诉我我有什么问题。您可以尝试一下以了解您需要解决的问题。
推荐阅读
- javascript - PaperJS 用颜色填充栅格而不迭代像素
- sql-server - Azure SQL 数据库中的“%TYPE”
- forms - 如何正确混合引导程序和 Google 表单
- excel - 删除工作表中的一个图像,并在 Excel 中删除多个图像
- angular - ngOnInit() 被调用两次并获得两个 API 响应
- asp.net-mvc - 从重载的AuthorizeAttribute的AuthorizeCore中获取partialview actionname和controllername
- scala - Flink 窗口和延迟事件
- javascript - 为什么状态没有正确更新?
- amazon-web-services - Alexa 与 AWS:AskSdk.S3PersistenceAdapter 错误无法读取项目
- javascript - 如何将普通的 JS 数组转换为 JSON 对象