Skip to content
Latchkey

npm "ERESOLVE" Conflict on webpack Version - Fix CI Installs

npm refused to install because a webpack plugin or loader declares a peer webpack version that conflicts with the webpack your project resolves. CI uses npm ci (strict), so the install aborts instead of guessing.

What this error means

npm ci/npm install fails with ERESOLVE could not resolve / ERESOLVE unable to resolve dependency tree, naming webpack and the offending package and their peer ranges.

npm
npm error code ERESOLVE
npm error ERESOLVE could not resolve
npm error While resolving: some-webpack-plugin@2.0.0
npm error Found: webpack@5.92.0
npm error Could not resolve dependency:
npm error peer webpack@"^4.0.0" from some-webpack-plugin@2.0.0

Common causes

Plugin peers an incompatible webpack major

A loader/plugin pins peer webpack@^4 while your app is on webpack 5 (or vice versa), so npm cannot satisfy both.

Lockfile drift between local and CI

A local --legacy-peer-deps install hid the conflict; CI's strict npm ci against the lockfile surfaces it.

How to fix it

Align the conflicting package to your webpack major

Upgrade (or replace) the plugin/loader to a release that peers your webpack version, then regenerate the lockfile.

Terminal
npm install some-webpack-plugin@latest
npm ls webpack   # confirm a single, satisfied webpack version

Pin a resolution instead of suppressing globally

Prefer a targeted overrides entry over a blanket --legacy-peer-deps, which silences every conflict.

package.json
// package.json
{ "overrides": { "some-webpack-plugin": { "webpack": "$webpack" } } }

How to prevent it

  • Commit the lockfile and install with npm ci so local and CI resolve identically.
  • Check a plugin's peer webpack range before adding or bumping it.
  • Prefer scoped overrides to repo-wide peer-dep bypass flags.

Frequently asked questions

What causes ""ERESOLVE" (webpack)"?
A loader/plugin pins peer webpack@^4 while your app is on webpack 5 (or vice versa), so npm cannot satisfy both.
How do I fix "ERESOLVE" (webpack)?
Upgrade (or replace) the plugin/loader to a release that peers your webpack version, then regenerate the lockfile.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card