Skip to content
Latchkey

Bun "FileNotFound ... package.json" / ENOENT in CI

Bun could not find package.json (or another file) at the path it expected. In CI this is a working-directory or checkout problem: the job is not running where the project lives.

What this error means

bun install or bun run fails with "error: FileNotFound" or "ENOENT: no such file or directory" referencing package.json or a script path.

Terminal
bun install
error: FileNotFound reading "package.json"
# or:
error: ENOENT: no such file or directory, open 'package.json'

Common causes

The step runs in the wrong directory

The job runs at the repo root or a subfolder that has no package.json, so Bun finds nothing to install or run.

The checkout omitted the project files

A sparse checkout, wrong path filter, or missing checkout step means package.json is not present on the runner.

How to fix it

Set the working directory to the project root

  1. Add a checkout step so files are present on the runner.
  2. Set working-directory to where package.json lives.
  3. Confirm with ls package.json before the Bun step.
.github/workflows/ci.yml
- uses: actions/checkout@v4
- run: bun install
  working-directory: apps/api

Reference files relative to the project

Point script and config paths at files that exist in the checked-out tree so ENOENT does not appear.

How to prevent it

  • Always run actions/checkout before Bun steps.
  • Set working-directory to the package root in monorepos.
  • Avoid sparse checkouts that drop package.json.

Related guides

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