Bun "lockfile had changes, but lockfile is frozen" in CI
You ran bun install --frozen-lockfile (Bun's default in CI) and the dependency set Bun resolved from package.json differs from the committed bun.lockb. Bun refuses to modify the lockfile and fails instead.
What this error means
CI stops with "error: lockfile had changes, but lockfile is frozen" while a plain bun install works locally and updates the lockfile.
bun install --frozen-lockfile
error: lockfile had changes, but lockfile is frozenCommon causes
package.json changed without updating bun.lockb
A dependency was added, removed, or bumped in package.json but the resolved bun.lockb was not regenerated and committed.
CI enforces a frozen lockfile by default
Bun treats install as frozen when CI is set (or you pass --frozen-lockfile), so any drift is an error rather than a silent relock.
How to fix it
Regenerate and commit the lockfile
- Run
bun installlocally to updatebun.lockbfor the new package.json. - Commit the updated
bun.lockbalongside the package.json change. - Re-run CI so the frozen install now matches.
bun install
git add bun.lockb package.json
git commit -m "Update bun lockfile"Keep the frozen check in CI
Install with the frozen flag explicitly so lockfile drift fails fast and lands with the dependency change.
- run: bun install --frozen-lockfileHow to prevent it
- Run bun install and commit bun.lockb whenever package.json deps change.
- Keep --frozen-lockfile in CI so drift is caught early.
- Review bun.lockb diffs in pull requests.