Category: javascript

yarn build error “Command failed with exit code 137”

yarn build error “Command failed with exit code 137”

When trying to compile an application running yarn build you may encounter error Command failed with exit code 137

Exist code 137 means the build process ran out of memory. You will need to increase the amount of memory available or enable swap.

I encountered this specific error while trying to run yarn build inside my strapi application. For my particular situation, the machine had 2GB of memory but I was also running vscode remote which uses a lot of memory. I was able to disconnect vscode and rerun the build process.

Another approach is to enable swap. instruction for enabling a swap file (virtual memory) on a ubuntu linux server can be found here.