npm ERR! ERESOLVE unable to resolve dependency tree
- npm
- Build
What it means
Two packages need different versions of the same dependency (often React), and npm refuses to guess. It usually starts after adding or upgrading one package.
Why it happens
- A new package supports only an older (or newer) React or Next.js than your project uses.
- Upgrading everything at once, so versions no longer agree.
How to fix it
- Read the conflict lines: they name the package and the versions it accepts.
- Install a version of that package that supports your setup, or wait for one.
- Use --legacy-peer-deps only as a stopgap, and test the feature it affects.
- Avoid --force: it installs a combination nobody has tested.
Let your AI find the cause
Paste this into Claude Code, Cursor, Lovable or whichever AI built your app. It looks first and changes nothing until you have read the answer.
npm install fails with ERESOLVE unable to resolve dependency tree. Without installing anything, read the conflict, tell me which package wants which version, and propose versions that agree with the rest of package.json.