npm ERR! code ERESOLVE: Peer Dependency Conflict Fix

Symptom

npm install aborts with ERESOLVE "Could not resolve dependency tree".

Root cause

Two packages demand incompatible versions of a shared dependency.

Fix, in order

1. See the conflict chainnpm ls <package>
2. Update the offender instead of forcingnpm outdated && npm update <old-package>
3. Force only with open eyesnpm install --legacy-peer-deps # legacy npm v6 behavior
4. Pin the resolution permanently"overrides": { "react": "^18.2.0" } # in package.json

Prevent it coming back

Lockfile in git; CI installs with npm ci so conflicts surface at PR time.

Run it on clean infra

Spinning up a fresh box to reproduce or escape this error?

DevOps tools shelf

Related

Cloud & DevOps tool comparisons · Hardware build guides

NinjaOps publishes free engineering guides. Some outbound links are affiliate links: they cost you nothing and support the site.

Last reviewed 2026-10-02 · NinjaOps SEO grid · DevOps blog