Blognpm

npm error ERESOLVE could not resolve How to fix it.

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.

How the Agent API works
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
  • What it meansA peer dependency conflict
  • The real fixMake the versions agree
  • The shortcutlegacy-peer-deps=true in .npmrc
  • On AntideployIt retries with that flag and tells you

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.

01Questions

Dependency conflict questions, answered.

Anything else? Write to us and a person answers.

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.

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.

Start from GitHub or a folder
Prompt copied Paste it into Claude Code, Codex or Cursor and press Enter.