Backstage "yarn build" failed in CI
Backstage builds the app with a bundler and the backend with the backstage-cli. A failed yarn build almost always has a specific cause in the log above the summary line: a missing module, a config error, or an out-of-memory kill.
What this error means
The build step ends with "error Command failed with exit code 1" after a bundler or backstage-cli trace pointing at a module, config, or memory problem.
$ backstage-cli repo build --all
Building app...
Failed to compile.
Module not found: Error: Can't resolve './components/Missing' in '/app/packages/app/src'
error Command failed with exit code 1.Common causes
A broken import or missing file
A module the bundler cannot resolve (a renamed file, a missing plugin) fails the compile with "Module not found".
A downstream cause: memory or config
The build can also fail from an out-of-memory kill or a missing app-config value; the real reason is the trace above the "Command failed" line.
How to fix it
Read the failure above the summary line
- Scroll up to the first "Module not found", "error TS", or "heap out of memory".
- Fix that specific cause (import, dependency, memory, or config).
- Re-run the build to confirm it compiles.
Build backend and app explicitly
Use the repo build so workspaces compile in the correct order before bundling.
yarn tsc
yarn build:backend
yarn build:allHow to prevent it
- Run the clean type check before build so import errors surface first.
- Provide required app-config values in the build environment.
- Set the heap size for large monorepo builds so memory does not kill the job.