Skip to content
Back to Error Database
npm

npm ERR! ERESOLVE unable to resolve dependency tree

npm v7+ enforces strict peer dependency resolution. This error occurs when two packages require incompatible versions of the same dependency.

Root Cause

Package A requires dependency@^2.0 but Package B requires dependency@^3.0. npm can't install both versions simultaneously. This happens most often when upgrading React, TypeScript, or other widely-used packages with strict peer dependencies.

How to Fix
  1. 1Read the error output to identify which packages are conflicting
  2. 2Option 1: Add --legacy-peer-deps to your install command (quick fix)
  3. 3Option 2: Update the conflicting package to a version compatible with your dependencies
  4. 4Option 3: Use npm overrides in package.json to force a specific version
  5. 5Update your CI workflow to use the same install command
Commands
# Quick fix — add to CI workflow:
npm ci --legacy-peer-deps

# Better fix — override in package.json:
# Add to package.json:
# "overrides": { "react": "$react" }
Prevention

Pin your dependency versions, use a lockfile (package-lock.json), run 'npm ci' instead of 'npm install' in CI, and regularly update dependencies to keep peer versions compatible.

Automate This

WarpFix detects "npm ERR! ERESOLVE unable to resolve dependency tree" automatically and opens a fix PR — before you even see the error.

WarpFix monitors your GitHub repos 24/7. When CI fails, it identifies the error, generates a fix, validates it in a sandbox, and opens a PR — automatically.

Install WarpFix — Free