1

When I run production build in angular app, I'm getting FatalProcessOutOfMemory error.

enter image description here

  • angular 6.0.8
  • type script :2.7.2
1

3 Answers 3

3

For production build, run following command:

node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build --prod
Sign up to request clarification or add additional context in comments.

Comments

1

For prod build, run following command:

node --max_old_space_size=4096 node_modules/@angular/cli/bin/ng build --target production

For more optimization flags, below command:

It has inbuilt cache busting and other goodies:

node --max_old_space_size=4096 node_modules/@angular/cli/bin/ng build --target production --build-optimizer --vendor-chunk

Comments

1

Navigate to AppData->Roming->npm

Open ng.cmd file and replace with below code :

  @IF EXIST "%~dp0\node.exe" (
  "%~dp0\node.exe" "--max_old_space_size=8192" "%~dp0\node_modules\@angular\cli\bin\ng" %*
) ELSE (
  @SETLOCAL
  @SET PATHEXT=%PATHEXT:;.JS;=;%
  node "--max_old_space_size=8192" "%~dp0\node_modules\@angular\cli\bin\ng" %*
)

and save it.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.