angular - 试图用 ngcc 备份文件覆盖 @angular/cdk/stepper/step-header.d.ts.__ivy_ngcc_bak,这是不允许的
问题描述
升级@angular/core
并@angular/material
使用ng update
命令后,ngcc
命令失败并出现以下错误
使用的命令:
ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points
错误:
> 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)
解决方案
升级到 Angular 9 并重新安装所有包/依赖项后,请务必清理您的工作区。它实际上解决了我的大部分错误。
通过删除 node_modules 文件夹、package_lock.json 并通过npm install
解决大部分问题重新安装所有包来清理工作区
- 删除您的
node_modules
文件夹 - 删除
package_lock.json
- 删除后重新安装软件包
npm install
推荐阅读
- scala - Spark Dataframe - 获取所有对列表(Scala)
- ibm-cloud - 我可以在某些节点中排除某些意图吗?
- perl - 监视和读取文件中的新行?
- winappdriver - 哪个工具与 windows 10 兼容,用于提取 windows 元素以实现窗口 gui 自动化
- c++ - 我可以在不重叠的情况下将多个协程生成到同一条链上吗?
- r - 根据列的聚合函数对数据框的行进行排序
- angular - 错误类型错误:_co.deleteConsulta 不是函数
- python - Python 如何处理在多个 Python 实例中导入同一个模块?
- c# - 类索引器设计以访问类中的所有数组
- python - 打印小数点后位数最少的浮点数