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
- Add a
checkoutstep so files are present on the runner. - Set
working-directoryto where package.json lives. - Confirm with
ls package.jsonbefore the Bun step.
.github/workflows/ci.yml
- uses: actions/checkout@v4
- run: bun install
working-directory: apps/apiReference 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
Bun "error: Script not found" (bun run) in CIFix Bun "error: Script not found" in CI - `bun run <name>` cannot find that script in package.json, from a ty…
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 "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…