运行ng serve
后,终端窗口出现异常:
将@ angular / core编译为esm5
Error: Error on worker #1: TypeError: Cannot read property 'map' of undefined
和以下消息:
An unhandled exception occurred: NGCC failed.
有关更多详细信息,请参见/tmp/ng-EAdxWj/angular-errors.log
。
angular-errors.log:
[error] Error: NGCC failed.
at NgccProcessor.process (/IdeaProjects/app/frontend/node_modules/@ngtools/webpack/src/ngcc_processor.js:76:19)
at /IdeaProjects/app/frontend/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:579:31
at SyncHook.eval [as call] (eval at create (/IdeaProjects/app/frontend/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:1)
at SyncHook.lazyCompileHook (/IdeaProjects/app/frontend/node_modules/tapable/lib/Hook.js:154:20)
at Object.webpack [as webpackFactory] (/IdeaProjects/app/frontend/node_modules/webpack/lib/webpack.js:55:30)
at createWebpack (/IdeaProjects/app/frontend/node_modules/@angular-devkit/build-webpack/src/webpack-dev-server/index.js:20:36)
at Object.runWebpackDevServer (/IdeaProjects/app/frontend/node_modules/@angular-devkit/build-webpack/src/webpack-dev-server/index.js:46:12)
at SwitchMapSubscriber.project (/IdeaProjects/app/frontend/node_modules/@angular-devkit/build-angular/src/dev-server/index.js:191:32)
at SwitchMapSubscriber._next (/IdeaProjects/app/frontend/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/operators/switchMap.js:49:27)
at SwitchMapSubscriber.Subscriber.next (/IdeaProjects/app/frontend/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/Subscriber.js:66:18)
at /IdeaProjects/app/frontend/node_modules/@angular-devkit/build-angular/node_modules/rxjs/internal/util/subscribeToPromise.js:7:24
at processTicksAndRejections (internal/process/task_queues.js:97:5)
答案 0 :(得分:10)
只是有同样的问题。
通过在tsconfig.app.json中添加以下内容来修复该问题:
"angularCompilerOptions": {
"enableIvy": false
},
希望这会有所帮助
答案 1 :(得分:4)
我遇到了错误:
Unknown arguments: use-program-dependencies, useProgramDependencies
An unhandled exception occurred: NGCC failed.
See "C:\...\angular-errors.log" for further details.
我刚刚更新了我的项目所需的angular cli,材质和核心以及其他模块,然后更新了npm和typescript包,仅此而已。
ng update @angular/cli @angular/core
npm update @angular/material @angular/cdk
npm install -g typescript@latest
答案 2 :(得分:3)
在我的特定情况下,运行npm审核修复程序后,我的package.json中的@ angular-devkit / build-angular更新为“ ^ 0.1002.0”。 (此版本似乎属于Angular 10,而不是本地项目的Angular版本(v9.1.3))
还原此更改后,一切又重新开始起作用:
“ @ angular-devkit / build-angular”:“〜0.901.12”
答案 3 :(得分:0)
我在本地和远程服务器上都有相同的 Linux 设置。在本地它有效,远程我有“NGCC失败”。信息量不大。
所以我开始重新安装所有东西:nodejs、npm、ng。我试图清除缓存并使缓存无效。没有任何帮助。
然后在某个时候我得到了:
<块引用>生成后抛出 ENOMEM 错误
这让我来到了Node.js catch ENOMEM error thrown after spawn
确实,我的主机是 1Gb RAM,没有交换。所以我添加了它并神奇地 ngcc 开始工作了。
现在我想知道是交换修复了它还是我努力在远程服务器上重新安装所有东西。