Angular-cli AOT构建失败,并显示“致命错误:CALL_AND_RETRY_LAST分配失败-JavaScript堆内存不足”

kis*_*oza 2 node.js angular-cli angular

我正在尝试使用AOT建立我的angular-cli项目

ng build --aot
Run Code Online (Sandbox Code Playgroud)

但失败并显示错误

“致命错误:CALL_AND_RETRY_LAST分配失败-JavaScript堆内存不足”

如果我使用--prod标志进行构建,也会发生相同的情况。

任何的想法?

Dav*_*vid 5

在github上已经存在一个问题:https : //github.com/angular/angular-cli/issues/5618

同时,作为解决方法,您可以尝试指定max_old_space_size设置(以MB为单位)

node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build --prod
Run Code Online (Sandbox Code Playgroud)