In this guide
A simple guide to this issue: 'npm ERR! ERESOLVE unable to resolve dependency tree'. Learn why it happens, what to check first, and how to fix it.
Since npm 7, peer dependencies are enforced strictly. When two packages disagree about a peer (commonly React versions), the install aborts. Here is how to read the conflict and fix it the right way.
The Error
npm ERR! ERESOLVE unable to resolve dependency tree. Could not resolve dependency: peer react@"^18.0.0" from some-lib@2.0.0
Step 1: Read Who Wants What
The error names the package and the peer version it requires versus the version you have. That tells you whether to upgrade the dependent package or wait for it to support your version.
The Quick Unblock
# Tells npm to use the older, lenient peer resolution
npm install --legacy-peer-depsWarning
--force and --legacy-peer-deps install anyway, but the conflict is real. The library may genuinely not support your React version — test thoroughly before shipping.
The Proper Fix
- Upgrade the conflicting library to a version that supports your peer (
npm install some-lib@latest). - Or align your core dependency to the version the library expects.
- Pin the resolution in package.json
overridesif you must force a single version across the tree.
Relevant Scaleup Infotech Services
Keep Reading
Fix React Search Results Showing the Wrong Data
Fix React search race conditions with request cleanup, cancellation, and stale-response checks. Includes code and a slow-network verification checklist.
5 min readFix Next.js Environment Variables Missing in Production
Fix missing Next.js production environment variables by checking build-time values, public prefixes, deployment settings, and the exact release artifact.
5 min readFix Laravel Queue Jobs Not Processing After Deployment
Recover Laravel queue jobs after deployment by checking the connection, queue name, workers, cached configuration, failed jobs, and restart behavior.
5 min read