Angular 12 Throwing this error FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Viewed 4526

I updated my angular application version from angular 8 to 12, In previous version when I hit ng server my application server properly without through an any error but after update it to V12 it through me an error when I run by

  1. ng serve
  2. node --max_old_space_size=8048 ./node modules/@angular/cli/bin/ng serve

Above commands also not works and it show me error

enter image description here

2 Answers

This error seems to be related to the generation of sourceMaps. Here is the issue on Github.

You can try disabling the generation of sourceMaps in angular.json as a workaround until the issue is resolved:

"sourceMap": false

I had this thing, than I changed my scripts to this:

 "start": "node --max_old_space_size=2192 ./node_modules/@angular/cli/bin/ng serve",
 "build": "node --max_old_space_size=2192 ./node_modules/@angular/cli/bin/ng build --configuration production --build-optimizer=false --output-hashing=all",

but for building problem didn't dissapear, so I updated node to version 16, and now it's working

Related