Strapi "strapi build" failed in CI
Strapi compiles its admin panel with a bundler during strapi build. The build fails when a required environment variable is absent, when the bundler runs out of memory on a small runner, or when a plugin cannot be compiled.
What this error means
A strapi build (or npm run build) step fails with a bundler error, "JavaScript heap out of memory", or "Missing ... environment variable" before the dist/ build completes.
[ERROR] Error: Missing apiToken salt. Please set the env var ADMIN_JWT_SECRET ...
at .../node_modules/@strapi/strapi/dist/...
error Command failed with exit code 1.Common causes
A required env var is unset at build time
Strapi reads secrets like APP_KEYS or ADMIN_JWT_SECRET during build; if they are not set, the build throws.
The bundler exhausts memory
On a small runner the admin build can exceed the default Node heap and crash with "heap out of memory".
How to fix it
Provide the required env at build time
- Set APP_KEYS, ADMIN_JWT_SECRET, and other required vars from secrets.
- Expose them to the build step environment.
- Re-run the build.
env:
APP_KEYS: ${{ secrets.APP_KEYS }}
ADMIN_JWT_SECRET: ${{ secrets.ADMIN_JWT_SECRET }}
NODE_ENV: productionRaise the Node heap for the build
Give Node more memory so the admin bundle does not exhaust the default heap.
NODE_OPTIONS=--max-old-space-size=4096 npm run buildHow to prevent it
- Set all build-time secrets in the CI environment.
- Increase
--max-old-space-sizeon memory-constrained runners. - Cache node_modules so plugin compilation is consistent.