Fix guides / npm: "ERESOLVE unable to resolve dependency tree"
How to fix npm "ERESOLVE unable to resolve dependency tree"
Your build stops at install with npm ERR! code ERESOLVE and ERESOLVE unable to resolve dependency tree, usually mentioning peer react@"^18" while you have React 19, or a similar clash. It often appears right after your AI tool upgraded one package.
Why it happens
A package declares which versions of another package it works with (a peer dependency). Since npm 7, npm refuses to install when those ranges conflict. Common cases: an older UI or chart library that only lists React 18 while your app uses React 19, or two plugins that want different versions of ESLint or Vite.
Fix 1: read the conflict
The lines under "Could not resolve dependency" name the package that wants an older version (for example peer react@"^16.8 || ^17 || ^18" from some-lib@2.1.0). That package is the one to deal with.
Fix 2: upgrade the package that is behind
npm view some-lib peerDependencies npm install some-lib@latest
Most popular libraries have a release that supports current React.
Fix 3: if no compatible version exists
If you have tested that it works anyway, tell npm explicitly in package.json:
"overrides": {
"some-lib": { "react": "$react", "react-dom": "$react-dom" }
}
As a last resort add a .npmrc file with legacy-peer-deps=true, which is what --legacy-peer-deps does, so Vercel and Netlify use it too. This hides the warning rather than solving it, so test the affected features.
Fix 4: commit a lockfile
Run a clean install locally, then commit package-lock.json so the host installs exactly what you tested.
Check the fix
- Delete
node_modules, runnpm ci, thennpm run build. - Redeploy.
Quick Fix, $49Full Rescue, $149Ask first
Last updated 2026-10-21.