esbuild "The service was stopped" - Fix Crashes in CI
esbuild runs as a long-lived child process that the JS API talks to. "The service was stopped" means that process exited unexpectedly - killed by the OOM killer, terminated by the runner, or crashed from a version mismatch.
What this error means
A build using esbuild (directly, or via Vite/tsup/Vitest) fails with Error: The service was stopped. It can be intermittent when caused by memory pressure on a busy runner, or consistent when it is a version/binary problem.
Error: The service was stopped
at /app/node_modules/esbuild/lib/main.js:1381:29
at Socket.<anonymous> (/app/node_modules/esbuild/lib/main.js:678:9)Common causes
The esbuild process was OOM-killed
On a memory-constrained runner the kernel can kill the esbuild child, and the JS side then reports the service stopped. This overlaps with build OOM.
Node/esbuild version or binary mismatch
A mismatched esbuild JS package and native binary, or running under an unsupported Node, can make the service crash on startup or mid-build.
How to fix it
Reduce memory pressure
- Run the build on a larger runner or lower concurrency so the esbuild process is not OOM-killed.
- Check
dmesg/runner logs for an OOM kill that coincides with the stop. - Limit parallel esbuild-driven tasks (e.g. test sharding) that compete for RAM.
Reinstall to fix a version/binary mismatch
Make sure the esbuild package and its platform binary match and match your Node.
rm -rf node_modules package-lock.json
npm install
node -p "require('esbuild').version"How to prevent it
- Size the build runner so esbuild is not killed under memory pressure.
- Reinstall from a clean lockfile so the esbuild binary matches the package.
- Run on a Node version esbuild supports.