ERESOLVE 📦 npm

npm ERR! code ERESOLVE — unable to resolve dependency tree

npm 7+ found conflicting peer dependency requirements and refuses to install a broken tree.

Seen on: npm Node.js

Meaning

A package declares a peerDependency range (e.g. react@^17) that conflicts with what you have (react@18). npm 7+ enforces peer dependencies strictly.

Common causes

  • Library not yet updated for your framework’s major version
  • Mixed major versions of a framework across packages
  • Stale lockfile after upgrades

⚡ Quick fix

  1. Read “Could not resolve dependency: peer X@… from Y@…” to see who conflicts
  2. Upgrade the conflicting package to a version supporting your framework
  3. Temporary: npm install --legacy-peer-deps
  4. Use overrides in package.json to force a version

Detailed fix by platform

npm

  1. Force a transitive version:
    json
    {
      "overrides": {
        "some-lib": { "react": "$react" }
      }
    }
  2. --legacy-peer-deps installs like npm 6 did; prefer upgrading the package.

How to diagnose

  1. Conflict — Which package requires which peer range?
  2. Upgrades — Is there a newer compatible version?

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.