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.
warn: incorrect peer dependency "react@17.0.2"
@acme/ui requires react@^18.0.0Common 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
- Read which package requires which peer range.
- Bump or pin the peer to a version inside that range.
- Reinstall and commit the updated lockfile.
bun install react@^18.0.0 react-dom@^18.0.0Deduplicate 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.
{
"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.