# npm ERESOLVE unable to resolve dependency tree

> Getting the error “npm ERESOLVE unable to resolve dependency tree”? Here is how to fix it. Two packages want different versions of the same dependency.

**npm ERESOLVE unable to resolve dependency tree.** Two packages need incompatible versions of a shared dependency (often React or Vite), so npm refuses to install.

- Web build. Conflicting package versions.
- Interactive page: https://capwr.app/free-tools/build-error-explainer/npm-eresolve
- Build error explainer: https://capwr.app/free-tools/build-error-explainer
- Last updated: 2026-10-03

## What this error means

Two packages need incompatible versions of a shared dependency (often React or Vite), so npm refuses to install.

## Why it happens

npm’s peer-dependency check found two packages that require different versions of the same dependency, and it will not pick one on its own.

## The message tools print

```
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
```

## How to fix it

1. Read the lines below the error: they name the two packages that disagree.
2. Update the older one, or pin versions that work together.
3. As a stopgap, npm install --legacy-peer-deps, then commit the lockfile.

## Check a log that shows this

Paste the failing step into the [build error explainer](https://capwr.app/free-tools/build-error-explainer). It matches this message, and any others in the same log, in your browser. Nothing is uploaded.

## Other Web build errors

- [npm ci needs an existing package-lock.json](https://capwr.app/free-tools/build-error-explainer/npm-ci-package-lock-json)
- [npm ci: lockfile is out of sync with package.json](https://capwr.app/free-tools/build-error-explainer/npm-ci-lockfile-out-of-sync)
- [JavaScript heap out of memory](https://capwr.app/free-tools/build-error-explainer/javascript-heap-out-of-memory)
- [Rollup failed to resolve import](https://capwr.app/free-tools/build-error-explainer/rollup-failed-to-resolve-import)
- [error TS: TypeScript errors stop the build](https://capwr.app/free-tools/build-error-explainer/typescript-error-ts)
- [Could not find the web assets directory](https://capwr.app/free-tools/build-error-explainer/could-not-find-the-web-assets-directory)
- [Capacitor: Invalid App ID](https://capwr.app/free-tools/build-error-explainer/invalid-app-id)

## Build the web app before the native one

CapWrapp installs dependencies from the lockfile, builds the site, and runs Capacitor sync before the native build, from the GitHub repo you connect.

[Get started free](https://capwr.app/login).

## About CapWrapp

CapWrapp turns a web app on GitHub — built with Lovable, Bolt, Base44, Cursor or by hand — into iPhone and Android apps. It adds Capacitor if the repo needs it, signs the builds, and ships them to TestFlight and Google Play from GitHub Actions, with no Mac or Xcode on your side. [Get started free](https://capwr.app/login) · [Lovable to App Store guide](https://capwr.app/guides/lovable-to-app-store)
