Skip to content
Latchkey

npm "ERESOLVE could not resolve peer dependency tree" in CI

npm 7+ enforces peer dependencies strictly. A package requires a peer version that conflicts with what is installed, so npm aborts with ERESOLVE rather than silently installing a mismatched tree.

What this error means

Install fails in CI with "ERESOLVE unable to resolve dependency tree" and a "Conflicting peer dependency" block. It may have worked under npm 6, which ignored peer conflicts.

node
npm error ERESOLVE unable to resolve dependency tree
npm error Found: react@17.0.2
npm error Could not resolve dependency:
npm error peer react@"^18.0.0" from some-ui@3.1.0

Common causes

A dependency requires a different peer version

A package needs react@18 while the app pins react@17 (or vice versa), and npm 7 refuses the conflict.

Transitive peer conflicts

Two dependencies demand incompatible peer ranges, leaving no single satisfying tree.

How to fix it

Resolve the real version conflict

Align the conflicting peer to a compatible version across the tree.

Terminal
npm install react@18 react-dom@18
npm ls react

Pin a compatible set with overrides

When a dependency lags, force a compatible version via overrides instead of disabling the check.

package.json
// package.json
{ "overrides": { "some-ui": { "react": "$react" } } }

How to prevent it

  • Keep shared peers (React, etc.) on one aligned major.
  • Use overrides to reconcile lagging dependencies rather than --force.
  • Run npm ci on a clean tree in CI to surface peer conflicts early.

Related guides

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