I am facing the below issue while using ng build --prod.
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out o
I was facing same issue with ionic 3 unit testing.
npm test
was getting memory issue in above command then got it fixed with below commands--
npm install node --max_old_space_size=8048 ./node_modules/@angular/cli/bin/ng test
npm install
node --max_old_space_size=8048 ./node_modules/@angular/cli/bin/ng test
It worked for me.