简体   繁体   中英

Upgrade to Angular 13 : Error - NGCC failed

I just upgraded to Angular 13 from v8. (All my angular dependencies set to 13.0.2) (Updated my node version to 12.20.2). When I try to ng serve, I get the following NGCC failed error

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)

I tried adding enableIvy: false in ts.config.json as follows, removed node moduled and reinstalled them. I still get the same error How do I fix this?

"angularCompilerOptions": {
    "enableIvy": false
  }

I had the error:

Unknown arguments: use-program-dependencies, useProgramDependencies An unhandled exception occurred: NGCC failed. See "C:...\angular-errors.log" for further details. I just updated angular cli, material and core, and other modules needed to my project, then updated npm and typescript package, and that's all.

ng update @angular/cli @angular/core

npm update @angular/material @angular/cdk

npm install -g typescript@latest

Update the angular to the latest version will solve the issue as my previous angular version was 13.2.1 and after updating it becomes 13.3.1

I've spent 2 days and finally got the issue fixed. Here are the steps that I followed.

1. Delete your package-lock.json
2. npm install --force
3. npm update --force

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM