debugModerate
npm install fails with ERESOLVE peer dependency conflict
Viewed 0 times
ERESOLVEpeer dependencylegacy-peer-depsoverridesdependency treeconflict
nodejsci-cdterminal
Error Messages
Problem
npm install fails with ERESOLVE unable to resolve dependency tree. Two packages require incompatible versions of the same peer dependency. Common with React ecosystem packages.
Solution
(1) Try npm install --legacy-peer-deps — uses npm v6 behavior that ignores peer dep conflicts. (2) Check which packages conflict and if newer versions are compatible. (3) Use overrides in package.json to force a specific version: { "overrides": { "react": "$react" } }. (4) Consider using pnpm which handles peer deps more flexibly. (5) Do NOT use --force in production — it can cause runtime crashes. Always test after resolving.
Why
npm v7+ enforces peer dependencies strictly by default, unlike v6 which only warned. Many packages have not updated their peer dependency ranges to match current ecosystem versions.
Revisions (0)
No revisions yet.