#✅ - Build failed without any hint on how to fix it: error code 137
7 messages · Page 1 of 1 (latest)
From the build logs, it seems that your build has failed due to running out of memory. I'd recommend trying the following workaround:
The default build container has 7 GB RAM and based on the node version being used the NodeJS heap size may vary. By setting this env variable, you can set the max old space size up to 5.5 GB.
version: 1
frontend:
phases:
preBuild:
commands:
- npm ci
- export NODE_OPTIONS=--max-old-space-size=5632
thanks@tame tinsel, I currently apply the solution from github but it takes more than an hour to build where it only takes 5 minutes from a local computer with 16G RAM.
As far as I know this is due to slow speed of using swap. Is there any way to speed it up? I noticed that the build required arround 10G memory.
my current build settings
frontend:
phases:
preBuild:
commands:
- export NODE_OPTIONS=--max-old-space-size=16384
- sudo fallocate -l 40G /swapfile
- sudo chmod 600 /swapfile
- sudo mkswap /swapfile
- sudo swapon /swapfile
- sudo swapon -s
build:
commands:
- npm run build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- .npm/**/*
- node_modules/**/*
- .next/cache/**/*
build timeout 120 minutes
Thanks for sharing the build settings and the workaround. Unfortunately, the memory on the default build container cannot be modified or upgraded, and we are actively working on prioritizing this feature. I'd recommend subscribing to the GitHub issue so you can track its status as we make progress on it.
✅ - Build failed without any hint on how to fix it: error code 137