npm "signal SIGKILL" / exit 137 in a Script - Fix Killed npm Step in CI
When npm reports a script failed with signal SIGKILL, npm did not fail - the OS killed the child process. The signal is SIGKILL (9), and in containers it almost always means the memory cgroup limit was hit.
What this error means
An npm run <script> step ends with npm reporting signal SIGKILL and the job exits 137. Nothing in your script logged an error; the process was terminated externally, typically by the OOM killer or a memory-limited container.
> app@1.0.0 build
> next build
npm error path /app
npm error command failed
npm error signal SIGKILL
npm error command sh -c next build
##[error]Process completed with exit code 137.Common causes
Out-of-memory kill by the OS or container
SIGKILL + exit 137 in CI is the classic OOM signature: the process exceeded the runner or container memory limit and the kernel killed it. npm just reports the signal.
A container memory limit lower than the build needs
A --memory cap on the build container (or a small runner) is exceeded by a heavy build/test, triggering the cgroup OOM killer.
How to fix it
Give the step more memory or use less
Raise the runner/container memory, or reduce the build’s peak usage.
# raise container memory (example)
docker run --memory=4g ...
# or reduce build memory pressure
NODE_OPTIONS=--max-old-space-size=3072 npm run buildConfirm it is memory, then trim
- Treat SIGKILL/137 as OOM until proven otherwise; check runner memory graphs.
- Lower bundler/test parallelism and disable CI source maps if not needed.
- Split a monolithic build/test into smaller steps.
How to prevent it
- Size runners/containers for peak build memory.
- Cap the V8 heap below the memory limit.
- Reduce parallelism and split heavy steps.