Angular cli complier fails randomly – Code Utility


I randomly get this error from time to time, and when i restart the server it works.
this error is only shown in this project, so i guess no issue related to the CLI itself.
Does anyone know what the potential cause of this issue ?, or to what is it related ?
as i believe it’s due to bad practices and the huge code size.

any suggestions to help reduce/fix this one ?

thank you in advance

terminal screenshot

error log

angular version


This error happens when you don’t have enough memory to build your app:

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - Javascript heap out of memory

I got this error on small server instance with only 1-2GB of RAM. I had to build my app locally and send the dist folder to my server via SSH to bypass the issue. You can also increase the memory size of the server to solve it.

In your case, as you mentioned you were on a local server with 16GB of RAM, it is more likely related with the Node.js memory limit.
The solution to run your ng build with increased memory is to start the node process with an additional V8 flag: –max-old-space-size.


node --max-old-space-size=8192 ./node_modules/@angular/cli/bin/ng build