Npm ERR! Exit status 137 - THE INCANTATION

I’m using NPM to build my application, but the builds keeps failing. It looks like the process gets killed because of out of memory.

How do I limit the amount of memory NPM takes?

The build container is currently limited to 2GB of memory, regardless of the plan you are on.

This will be changed in the near future, but meanwhile, you can limit the amount of memory NPM uses by changing the NODE_OPTIONS via your .platform.app.yaml file.

variables:
       env:
           NODE_OPTIONS: --max_old_space_size=1536
1 Like

Some useful keywords here: webpack, react, create-react-app, react-scripts build
Error message: The build failed because the process exited too early. This probably means the system ran out of memory or someone called kill -9 on the process.