Skip to content
Latchkey

Bun "incorrect peer dependency" resolution in CI

A package declares a peerDependencies range that the version Bun installed does not satisfy. Bun surfaces the mismatch so you can align the peer before it breaks at runtime or build time.

What this error means

bun install prints an incorrect/unmet peer dependency warning, or a build later fails because two copies of a peer (for example React) are loaded.

Terminal
warn: incorrect peer dependency "react@17.0.2"
  @acme/ui requires react@^18.0.0

Common causes

The installed peer is outside the required range

Your direct dependency pins a peer (React, a plugin host) at a version a package does not accept, so the peer requirement is unmet.

Two versions of the same peer are resolved

Conflicting constraints cause Bun to keep two copies of a singleton peer, which then misbehaves at build or runtime.

How to fix it

Align the peer to a satisfying version

  1. Read which package requires which peer range.
  2. Bump or pin the peer to a version inside that range.
  3. Reinstall and commit the updated lockfile.
Terminal
bun install react@^18.0.0 react-dom@^18.0.0

Deduplicate a singleton peer

Force a single version of a peer that must be a singleton using an overrides/resolutions field so only one copy is installed.

package.json
{
  "overrides": { "react": "18.3.1" }
}

How to prevent it

  • Keep singleton peers (React, plugin hosts) pinned consistently.
  • Use overrides to force a single peer version when needed.
  • Resolve peer warnings before they become runtime failures.

Related guides

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