# npm error ERESOLVE could not resolve How to fix it.

URL: https://antideploy.com/blog/npm-err-eresolve-unable-to-resolve-dependency-tree

Two of your packages need conflicting versions of a third package, and npm will not choose. Align them, or tell npm to ignore peer conflicts.

**What you see**

```
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error
npm error While resolving: react-dom@18.3.1
npm error Found: react@19.0.0
npm error Could not resolve dependency:
npm error peer react@"^18.3.1" from react-dom@18.3.1
```

## At a glance

- **What it means**: A peer dependency conflict
- **The real fix**: Make the versions agree
- **The shortcut**: legacy-peer-deps=true in .npmrc
- **On Antideploy**: It retries with that flag and tells you

Published 7 October 2026. Facts checked 7 October 2026. 1 min read.

## What it means

Some packages say which version of another package they work with. This is called a peer dependency. In the example, `react-dom` needs React 18, and your project has React 19. npm refuses to guess, so the install stops. The log names the packages in conflict.

## How to fix it

### 1. Read which packages conflict

The lines in the log name the package, the version found and the version wanted.

### 2. Make the versions agree

Upgrade or downgrade one of the packages so that they fit together. This is the real fix. Ask your agent: "Resolve the ERESOLVE conflict by aligning versions."

### 3. Or tell npm to ignore peer conflicts

Add a file named `.npmrc` next to `package.json` with this line, then commit it:

**.npmrc**

```
legacy-peer-deps=true
```

This makes npm install anyway, as `npm install --legacy-peer-deps` does on your machine.

## Why it happens

The project often installs on its author's machine, because they ran `npm install --legacy-peer-deps` once. The lock file written then fails a strict `npm ci` on a clean server.

## What Antideploy does

Antideploy recognises this failure. It adds `legacy-peer-deps=true` in its own copy of your source for that build, and tells you it did. It never edits your repository. To keep every machine and host building the same way, fix the versions or commit the `.npmrc` yourself.

## Dependency conflict questions, answered.

Anything else? Write to us and a person answers.

[support@antideploy.com](mailto:support@antideploy.com)

### Is legacy-peer-deps safe?

It is safe to install, but it can leave two packages that are not meant to work together. Aligning the versions is the cleaner fix.

### Should I use --force?

It hides the conflict in a harsher way. Prefer aligning the versions.

### Does this failed deploy cost anything?

No. Failed deploys never count against your plan.

## More guides, and the platform.

Each platform page covers one part of Antideploy: what it does, where it stops and the questions people ask. [See the whole platform](https://antideploy.com/platform), or [all the guides](https://antideploy.com/blog).

- [npm ci can only install packages when your package.json and package-lock.json are in sync](https://antideploy.com/blog/npm-ci-can-only-install-packages-when-package-json-and-package-lock-json-are-in-sync): The lock file does not match package.json. Run npm install and commit the lock file.
- [npm error EBADPLATFORM Unsupported platform](https://antideploy.com/blog/npm-error-ebadplatform-unsupported-platform): Your lock file requires a package for another operating system. Regenerate and commit it.
- [How to let your agent read logs and fix a failed deploy](https://antideploy.com/blog/how-to-let-your-coding-agent-read-logs-and-fix-a-failed-deploy): The loop: read the reason, read the logs, fix the code, deploy again. And what Antideploy repairs for you.

- [Deployments](https://antideploy.com/platform/deployments)
- [Logs and monitoring](https://antideploy.com/platform/logs-and-monitoring)

Facts on this page were checked against the live platform on 7 October 2026.

## Deploy something. Start with one sentence.

Paste one sentence into your coding agent, click Approve once, and get a live link. No card, no trial clock.

To set this up, give your coding agent this sentence:

```text
Set this project up to deploy on Antideploy. Fetch https://antideploy.com/agent.md and follow it.
```
