Después de actualizar @angular/core y @angular/material usando el comando de ng update , el comando ngcc falla con el siguiente error
comando utilizado:
ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points
Error:
> Compiling @angular/cdk/stepper : es2015 as esm2015 > Compiling @angular/cdk/drag-drop : es2015 as esm2015 > Error: Error on worker #3: Error: Tried to overwrite node_modules/@angular/cdk/stepper/step-header.d.ts.__ivy_ngcc_bak with an ngcc back up file, which is disallowed. > at NewEntryPointFileWriter.InPlaceFileWriter.writeFileAndBackup (node_modules/@angular/compiler-cli/ngcc/src/writing/in_place_file_writer.js:37:23) > at NewEntryPointFileWriter.writeFile (node_modules/@angular/compiler-cli/ngcc/src/writing/new_entry_point_file_writer.js:64:53) > at node_modules/@angular/compiler-cli/ngcc/src/writing/new_entry_point_file_writer.js:46:69 > at Array.forEach (<anonymous>) > at NewEntryPointFileWriter.writeBundle (node_modules/@angular/compiler-cli/ngcc/src/writing/new_entry_point_file_writer.js:46:30) > at ClusterWorker.compile (node_modules/@angular/compiler-cli/ngcc/src/main.js:173:32) > at Worker.<anonymous> (node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/worker.js:44:42) > at Worker.emit (events.js:321:20) > at process.<anonymous> (internal/cluster/worker.js:32:12) > at process.emit (events.js:321:20) > at ClusterMaster.onWorkerMessage (node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:158:27) > at node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:46:95 > at ClusterMaster.<anonymous> (node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:238:57) > at step (node_modules/tslib/tslib.js:136:27) > at Object.next (node_modules/tslib/tslib.js:117:57) > at node_modules/tslib/tslib.js:110:75 > at new Promise (<anonymous>) > at Object.__awaiter (node_modules/tslib/tslib.js:106:16) > at EventEmitter.<anonymous> (node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:232:32) > at EventEmitter.emit (events.js:321:20)Asegúrese de limpiar su espacio de trabajo después de actualizar a angular 9 y reinstalar todos los paquetes/dependencias. De hecho, resolvió la mayoría de mis errores.
Limpiar el espacio de trabajo eliminando la carpeta node_modules, package_lock.json y reinstalando todos los paquetes mediante npm install resolvió la mayoría de los problemas
node_modulespackage_lock.jsonnpm installenableIvy funcionó para mí.
desde el archivo tsconfig , en angularCompilerOptions
agregar "enableIvy": false
En mi caso, usé una biblioteca Angular 11 dentro de una aplicación de consumidor usando npm link .
Recibí el error al ejecutar npm start en la aplicación del consumidor. La solución para mí fue esto en tsconfig.json de la biblioteca (antes era "falso").
angularCompilerOptions": { "enableIvy": true }Es interesante cómo esta solución es opuesta a la de Angular 9 mencionada anteriormente por @Ahmed El-Araby, tal vez porque en Angular 11 Ivy está habilitado de forma predeterminada