Skip to content
ohsudo, Home
CI/CD

npm "ERESOLVE unable to resolve dependency tree": a peer dependency that doesn't fit

Fix npm "ERESOLVE unable to resolve dependency tree": find the peer conflict, update the package, use overrides, or --legacy-peer-deps.

Beginner3 min readApplies to npm 7+ · npm 10 · npm 11 · Node.js 18+

by OhSudo ·

Checked on real software: npm · November 2026How we check

npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: my-app@1.0.0
npm error Found: react@19.0.0
npm error node_modules/react
npm error react@"^19.0.0" from the root project
npm error
npm error Could not resolve dependency:
npm error peer react@"^16.6.0 || ^17.0.0 || ^18.0.0" from react-helmet-async@1.3.0
npm error node_modules/react-helmet-async
npm error react-helmet-async@"1.3.0" from the root project

Older npm versions print npm ERR! in place of npm error. Either way, the message is precise. One package, here react-helmet-async@1.3.0, says it only works with React 16, 17 or 18, its “peer dependency”. Your project uses React 19. Since npm 7, npm refuses to install a combination that a package says it doesn’t support.

So it’s a real version conflict, and there are honest fixes before reaching for --legacy-peer-deps.

TL;DR

Terminal window
npm view react-helmet-async versions --json
npm view react-helmet-async@latest peerDependencies
npm install react-helmet-async@latest

If a newer version supports your React, that’s the fix. If none does yet, section 4.

1. Read the three lines that matter

  • Found: react@19.0.0: what you have.
  • peer react@"^16.6.0 || ^17.0.0 || ^18.0.0": what the other package accepts.
  • from react-helmet-async@1.3.0: who’s asking.

That last package is the one to update, replace, or override.

2. Update the package that’s asking

Libraries usually add support for new major versions in their own new releases. Check what the latest one accepts:

Terminal window
npm view react-helmet-async@latest peerDependencies

If it includes your version, install it:

Terminal window
npm install react-helmet-async@latest

Read its changelog for breaking changes, as it may be a new major version itself.

3. Or match the version it wants

If the library is essential, and has no compatible release yet, stay on the major version it supports, for now:

Terminal window
npm install react@18 react-dom@18

That’s the usual choice right after a big new release of a framework, while libraries catch up.

4. Override, if you’ve checked it works

If you know the library works with your version, because its maintainers say so, or your tests pass, tell npm explicitly, in package.json:

{
"overrides": {
"react-helmet-async": {
"react": "$react"
}
}
}

$react means “the version this project depends on”. Unlike the next option, this applies to one package, and is written down where everyone sees it.

5. –legacy-peer-deps, and its cost

Terminal window
npm install --legacy-peer-deps

This tells npm to ignore peer dependencies altogether, as npm 6 did. The install succeeds, and every peer conflict in the project is now hidden, including ones that break things at runtime. To use it everywhere, it goes into .npmrc as legacy-peer-deps=true, which then also applies in CI.

--force is broader still, and installs even more mismatched versions. Avoid it.

6. Make CI match your machine

If it works locally and fails in CI, compare:

Terminal window
node --version
npm --version

Different npm versions resolve differently. Commit package-lock.json, use npm ci in pipelines, and the same Node.js version everywhere. The Dockerfile Generator builds Node.js images from a fixed major version and your package-lock.json. To see why a package is installed, use npm explain react.

Warning

Deleting package-lock.json and node_modules to get past this makes npm pick new versions of everything, and can bring in unrelated breaking changes. Fix the one conflict instead. And be wary of --legacy-peer-deps in .npmrc: it quietly applies to every future install.

Shell, we have a problem!

Similar, but different: EACCES: permission denied is about folder permissions on global installs. ETARGET No matching version found means the version you asked for doesn’t exist. ENOTFOUND registry.npmjs.org is a network or DNS problem: see Temporary failure in name resolution. For Python’s version of a protected install, see externally-managed-environment. gyp ERR! is a native module that fails to compile. In CI, npm ci can only install packages when … in sync is an outdated lock file.

Found this useful? Share it.

Found a mistake? Let us know at contact@ohsudo.com.

Tools

Try it yourself

Articles

Related articles