4

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?

David
  • 33,444
  • 11
  • 80
  • 118
kishan oza
  • 61
  • 2
  • 6

2 Answers2

6

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
David
  • 33,444
  • 11
  • 80
  • 118
1

npm install

node --max_old_space_size=8048 ./node_modules/@angular/cli/bin/ng serve

Govind Sharma
  • 127
  • 1
  • 4