npm error ERESOLVE: unable to resolve dependency tree
Quick answer
Two of your dependencies require conflicting versions of the same peer dependency, and npm (since v7) refuses to silently guess which one to use. Update the conflicting packages to compatible versions where possible; `--legacy-peer-deps` is a last resort that may install a version that isn't actually compatible.
What causes this error
Starting with npm 7, peer dependencies are resolved and validated strictly by default. If package A needs react@^18 as a peer and package B needs react@^19, npm can't satisfy both simultaneously in a flat tree and stops rather than silently installing a version that could break one of them.
The Fix
# 1. Read the actual conflict npm reports — it names both packages and
# the exact version ranges that don't overlap
# 2. Best fix: upgrade the outdated package to a version that supports
# the newer peer dependency
npm install some-outdated-package@latest
# 3. Last resort — bypass strict peer resolution (npm picks one,
# which may cause subtle runtime bugs if the versions aren't actually compatible)
npm install --legacy-peer-depsCommon causes / variations
- Upgrading a major framework version (e.g. React 18 → 19) before all your UI library dependencies have caught up
- A stale, unmaintained package pinning an old peer dependency range that's now genuinely incompatible
- Installing a new package into a project that already has conflicting transitive peer requirements
Related errors
See also: Module not found tailwindcss after Vercel build, @prisma/client did not initialize.
Was this fix helpful?
Comments
Loading comments...