Bun "error: Script not found" (bun run) in CI
You ran bun run <name> and Bun found no script or binary by that name. In CI this is usually a typo, a job running in the wrong directory, or a scripts entry that only exists on your branch.
What this error means
A step calling bun run build (or similar) fails with "error: Script not found \"build\"" while the same command works locally.
Terminal
bun run build
error: Script not found "build"Common causes
The script name is misspelled or absent
The scripts block in package.json has no entry matching the name Bun was asked to run.
The job runs in the wrong directory
In a monorepo, the step runs where a different package.json (without that script) lives, so Bun cannot find it.
How to fix it
Confirm the script exists and the directory is right
- Run
bun runwith no args to list available scripts. - Fix the script name or add the missing
scriptsentry. - Set
working-directoryso the step runs where the script is defined.
package.json
{
"scripts": { "build": "bun build ./src/index.ts --outdir dist" }
}Run from the correct package directory
Point the step at the package that defines the script in a monorepo.
.github/workflows/ci.yml
- run: bun run build
working-directory: apps/webHow to prevent it
- List scripts with bun run to confirm names before CI.
- Set working-directory for monorepo package scripts.
- Keep script names consistent across packages.
Related guides
Bun "Cannot find module" / "Could not resolve" in CIFix Bun "error: Cannot find module" and "Could not resolve" in CI - Bun could not resolve an import because t…
Bun workspaces package not found / resolution in CIFix Bun workspaces resolution in CI - a monorepo workspace package is not found because the workspaces glob,…
Bun "FileNotFound ... package.json" / ENOENT in CIFix Bun "error: FileNotFound" for package.json and ENOENT in CI - Bun ran in a directory with no package.json…