Skip to content
Latchkey

Bun "error: Failed to install ... failed to resolve" in CI

Bun queried the registry and could not resolve a package version that satisfies your constraints. It reports "failed to resolve" for the offending dependency and aborts the install.

What this error means

bun install stops with "error: Failed to install" and a "failed to resolve <pkg>@<range>" line naming a version or range the registry does not offer.

Terminal
bun install
error: failed to resolve "left-pad@^99.0.0" from package.json
error: Failed to install 1 package

Common causes

The requested version range does not exist

The specifier in package.json points at a version no published release satisfies, so Bun has nothing to resolve.

The package is private or on another registry

A scoped or private package is not on the default registry, so Bun cannot find any matching version without the right registry configured.

How to fix it

Pin a version that is published

  1. Check the real published versions of the package.
  2. Correct the range in package.json to one that exists.
  3. Run bun install and commit the updated lockfile.
Terminal
bun install left-pad@^1.3.0

Point the scope at the right registry

For private or scoped packages, configure the registry in bunfig.toml so Bun can resolve them.

bunfig.toml
[install.scopes]
"@acme" = { url = "https://npm.acme.internal/", token = "$NPM_TOKEN" }

How to prevent it

  • Use ranges that match published versions.
  • Configure private registries and scopes in bunfig.toml.
  • Commit bun.lockb so resolution runs once, not on every job.

Related guides

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