在使用 Angular 10 的过程中,由于 NGCC 失败并出现未处理的异常,导致应用程序无法编译。这种问题通常在使用一些第三方依赖项时出现,因为它们的模块可能不符合 Angular 的编译要求。
解决方法包括以下步骤:
确认问题出现在哪个第三方依赖项上。
在构建配置中,使用"skipLibCheck"选项跳过编译器的库检查,以让 NGCC 能够继续编译应用程序。
执行命令'npm install
下面是一个示例代码,可以解决此问题:
"build": { "builder": "@angular-devkit/build-angular:browser", "options": { "vendorChunk": true, "buildOptimizer": true, "skipLibCheck": true, // 跳过库检查 "outputPath": "dist/test-app" } }
执行以上三个步骤,可以解决'Angular - 10 - NGCC fails with an unhandled exception”的问题。
上一篇:Angular--今天日期与从API返回的日期之间的差异。
下一篇:Angular-10中出现“YoumustpassinaNgModuleorNgModuleFactorytobebootstrapped”错误提示。