npm ERR! code ERESOLVE — unable to resolve dependency tree
npm 7+ found conflicting peer dependency requirements and refuses to install a broken tree.
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
- Read “Could not resolve dependency: peer X@… from Y@…” to see who conflicts
- Upgrade the conflicting package to a version supporting your framework
- Temporary:
npm install --legacy-peer-deps - Use
overridesin package.json to force a version
Detailed fix by platform
npm
- Force a transitive version:json
{ "overrides": { "some-lib": { "react": "$react" } } } --legacy-peer-depsinstalls like npm 6 did; prefer upgrading the package.
How to diagnose
- Conflict — Which package requires which peer range?
- 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.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026