Skip to main content
AllDevToolsHub
Back to error codes
ERROR ERESOLVE

npm ERESOLVE, Peer Dependency Conflict

npm/pnpm Error

npm cannot resolve the dependency tree because of conflicting peer dependency requirements.

Root Cause

Two packages require different versions of the same peer dependency, and npm cannot find a version that satisfies both.

How to Fix

Use --legacy-peer-deps to bypass the check (npm 7+). Or upgrade/downgrade packages to find compatible versions. Check the npm peer dependency documentation.

Quick Summary

ERESOLVE means npm cannot resolve conflicting peer dependencies. Quick fix: npm install --legacy-peer-deps. Better fix: upgrade packages to compatible versions.

Key Takeaways

Key Takeaways

  • npm 7+ enforces peer dependencies strictly, npm 6 was lenient
  • --legacy-peer-deps bypasses the check but may cause runtime issues
  • Check the error output to identify which packages conflict
  • Use npm ls <package> to see the dependency tree
Use Cases

When to use it

  • Installing a package that requires an older version of React
  • Upgrading one package that conflicts with another's peer deps
Watch out

Common Mistakes

  • Always using --legacy-peer-deps without investigating, this can cause subtle runtime bugs
  • Not checking if a newer version of the conflicting package resolves the issue
FAQ

ERESOLVE npm ERESOLVE, Peer Dependency Conflict, Frequently Asked

What does --legacy-peer-deps do?

It tells npm to use the npm 6 behavior: install packages even if peer dependencies conflict, without throwing an error.

Still having issues?

Check your network logs or use our developer tools to inspect headers, decode tokens, or validate your requests.