Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular-cli AOT build fails with "FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory"

I am trying to build my angular-cli project with AOT

ng build --aot

but it failes with error

"FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory"

The same thing happens if I build with the --prod flag.

Any idea?

like image 344
kishan oza Avatar asked Nov 05 '25 16:11

kishan oza


1 Answers

There is already an issue opened on github: https://github.com/angular/angular-cli/issues/5618

Meanwhile, as a workaround, you can try specifying the max_old_space_size setting (in MB)

node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build --prod
like image 111
David Avatar answered Nov 08 '25 13:11

David