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
2 Likes

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.

@matthias-van-woensel Is the build container still limited to 2GB of memory?
Because I’m facing the same issue, even limiting the amount of memory NPM uses for the above example.
Are there another possible solutions to try to apply?

It currently still is yes. We are working on an alternative. But that’s not ready yet.

Could you try with yarn? Does that give better results?
Reach out to the support team to get some additional help.

Thanks @matthias-van-woensel for the quick answer, the support team helped me to solve it.