Skip to content
Latchkey

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

  1. Run bun run with no args to list available scripts.
  2. Fix the script name or add the missing scripts entry.
  3. Set working-directory so 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/web

How 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

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →