When running bigger applications you might run into the memory limit of node. I had that issue recently with an Angular application.

Usually the build process is triggered through npm run build and the build process is defined in the package.json the following way:

"scripts": {
  ...
  "build": "ng build --prod",
  ...

Apparently the current default memory limit for node on a 64bit system is 1GB. This wasn't enough for the application any more. To give it enough headspace, I configured it to use 4GB instead. The option --max_old_space_size used takes the attribute in MB. Running ng through node with the option set looks like this:

"scripts": {
  ...
  "build": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build --prod",
  ...

Of course it's always better to reduce the memory needed,  but at a certain point we won't get around the solution of increasing the memory limit.