【问题标题】:Upgrade to Angular 13 : Error - NGCC failed升级到 Angular 13:错误 - NGCC 失败
【发布时间】:2022-04-01 16:54:13
【问题描述】:

我刚刚从 v8 升级到 Angular 13。 (我所有的角度依赖项都设置为 13.0.2)(将我的节点版本更新为 12.20.2)。当我尝试 ng 服务时,我收到以下 NGCC failed 错误

Error: Error on worker #1: TypeError: ts24.isNamedTupleMember is not a function
    at StaticInterpreter.visitType (file:///Users/k28483/Documents/WORK/MAP/periscope/node_modules/@angular/compiler-cli/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js:3340:21)
    at StaticInterpreter.visitVariableDeclaration (file:///Users/k28483/Documents/WORK/MAP/periscope/node_modules/@angular/compiler-cli/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js:3027:36)
    at StaticInterpreter.visitDeclaration (file:///Users/k28483/Documents/WORK/MAP/periscope/node_modules/@angular/compiler-cli/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js:3006:19)
    at StaticInterpreter.visitAmbiguousDeclaration (file:///Users/k28483/Documents/WORK/MAP/periscope/node_modules/@angular/compiler-cli/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js:3085:165)
    at StaticInterpreter.visitIdentifier (file:///Users/k28483/Documents/WORK/MAP/periscope/node_modules/@angular/compiler-cli/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js:2989:25)
    at StaticInterpreter.visitExpression (file:///Users/k28483/Documents/WORK/MAP/periscope/node_modules/@angular/compiler-cli/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js:2882:21)
    at StaticInterpreter.visitObjectLiteralExpression (file:///Users/k28483/Documents/WORK/MAP/periscope/node_modules/@angular/compiler-cli/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js:2934:28)
    at StaticInterpreter.visitExpression (file:///Users/k28483/Documents/WORK/MAP/periscope/node_modules/@angular/compiler-cli/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js:2880:21)
    at StaticInterpreter.visitArrayLiteralExpression (file:///Users/k28483/Documents/WORK/MAP/periscope/node_modules/@angular/compiler-cli/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js:2920:25)
    at StaticInterpreter.visitExpression (file:///Users/k28483/Documents/WORK/MAP/periscope/node_modules/@angular/compiler-cli/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js:2894:21)
    at ClusterMaster.onWorkerMessage (file:///Users/k28483/Documents/WORK/MAP/periscope/node_modules/@angular/compiler-cli/bundles/ngcc/main-ngcc.js:5139:15)
    at file:///Users/k28483/Documents/WORK/MAP/periscope/node_modules/@angular/compiler-cli/bundles/ngcc/main-ngcc.js:5049:72
    at EventEmitter.<anonymous> (file:///Users/k28483/Documents/WORK/MAP/periscope/node_modules/@angular/compiler-cli/bundles/ngcc/main-ngcc.js:5207:15)
    at EventEmitter.emit (events.js:314:20)
    at Worker.<anonymous> (internal/cluster/master.js:174:13)
    at Worker.emit (events.js:314:20)
    at ChildProcess.<anonymous> (internal/cluster/worker.js:32:12)
    at ChildProcess.emit (events.js:314:20)
    at emit (internal/child_process.js:877:12)
    at processTicksAndRejections (internal/process/task_queues.js:85:21)
(node:25668) UnhandledPromiseRejectionWarning: Error: NGCC failed.
    at NgccProcessor.process (/Users/k28483/Documents/WORK/MAP/periscope/node_modules/@ngtools/webpack/src/ngcc_processor.js:146:19)
    at /Users/k28483/Documents/WORK/MAP/periscope/node_modules/@ngtools/webpack/src/ivy/plugin.js:141:27
    at Hook.eval [as call] (eval at create (/Users/k28483/Documents/WORK/MAP/periscope/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:30:1)
    at Hook.CALL_DELEGATE [as _call] (/Users/k28483/Documents/WORK/MAP/periscope/node_modules/tapable/lib/Hook.js:14:14)
    at Compiler.newCompilation (/Users/k28483/Documents/WORK/MAP/periscope/node_modules/webpack/lib/Compiler.js:1054:30)
    at /Users/k28483/Documents/WORK/MAP/periscope/node_modules/webpack/lib/Compiler.js:1099:29
    at eval (eval at create (/Users/k28483/Documents/WORK/MAP/periscope/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:18:1)
(node:25668) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:25668) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
⠼ Generating browser application bundles (phase: setup)...(node:25746) UnhandledPromiseRejectionWarning: Error: write EPIPE
    at process.target._send (internal/child_process.js:807:20)
    at process.target.send (internal/child_process.js:678:19)
    at file:///Users/k28483/Documents/WORK/MAP/periscope/node_modules/@angular/compiler-cli/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js:13756:13
    at new Promise (<anonymous>)
    at sendMessageToMaster (file:///Users/k28483/Documents/WORK/MAP/periscope/node_modules/@angular/compiler-cli/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js:13752:10)
    at Worker.<anonymous> (file:///Users/k28483/Documents/WORK/MAP/periscope/node_modules/@angular/compiler-cli/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js:13817:17)
    at Worker.emit (events.js:314:20)
    at process.<anonymous> (internal/cluster/worker.js:32:12)
    at process.emit (events.js:314:20)
    at emit (internal/child_process.js:877:12)
(node:25746) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:25746) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
⠏ Generating browser application bundles (phase: setup)...(node:25741) UnhandledPromiseRejectionWarning: Error: write EPIPE
    at process.target._send (internal/child_process.js:807:20)
    at process.target.send (internal/child_process.js:678:19)
    at file:///Users/k28483/Documents/WORK/MAP/periscope/node_modules/@angular/compiler-cli/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js:13756:13
    at new Promise (<anonymous>)
    at sendMessageToMaster (file:///Users/k28483/Documents/WORK/MAP/periscope/node_modules/@angular/compiler-cli/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js:13752:10)
    at Worker.<anonymous> (file:///Users/k28483/Documents/WORK/MAP/periscope/node_modules/@angular/compiler-cli/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js:13817:17)
    at Worker.emit (events.js:314:20)
    at process.<anonymous> (internal/cluster/worker.js:32:12)
    at process.emit (events.js:314:20)
    at emit (internal/child_process.js:877:12)
(node:25741) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

我尝试在 ts.config.json 中添加 enableIvy : false 如下,删除节点模块并重新安装它们。我仍然收到同样的错误我该如何解决这个问题?

"angularCompilerOptions": {
    "enableIvy": false
  }

【问题讨论】:

  • 可能是这样的:“警告:我们不支持一次跨多个主要版本迁移。请单独迁移每个主要版本。”来自@ 987654321@?
  • 逐步完善升级版本。谢谢@RandyCasburn

标签: javascript node.js angular


【解决方案1】:

我遇到了这个错误:

未知参数:use-program-dependencies、useProgramDependencies An 发生未处理的异常:NGCC 失败。看 “C:...\angular-errors.log”了解更多详情。

我刚刚更新了 Angular Cli、material 和 Core 以及我的项目所需的其他模块,然后更新了 npm 和 typescript 包,仅此而已。

ng update @angular/cli @angular/core
npm update @angular/material @angular/cdk
npm install -g typescript@latest

【讨论】:

  • 我试过这个,我仍然得到完全相同的错误
  • @SaiKrishna 您的问题解决了吗?如果是,怎么做?
  • @KartikWatwani,正如上面 Randy Casburn 所建议的,我采取了逐步升级到更高版本的方法,如下:update.angular.io/?v=8.0-13.0
【解决方案2】:

将 Angular 更新到最新版本将解决问题 因为我之前的 Angular 版本是 13.2.1,更新后它变成了 13.3.1

【讨论】:

    猜你喜欢
    • 2021-12-17
    • 2020-07-10
    • 2021-12-30
    • 1970-01-01
    • 2020-08-27
    • 2017-10-20
    • 2022-08-22
    • 2022-08-17
    • 1970-01-01
    相关资源
    最近更新 更多