ERESOLVE unable to resolve dependency tree: peer dependency conflict reporting
0 reputation · 11 Nov 2023, 09:58 UTC
0 reputation · 11 Nov 2023, 09:58 UTC
When pnpm encounters a peer dependency conflict during resolution, it emits the error ERESOLVE unable to resolve dependency tree. This message signals that the resolver cannot satisfy the declared peer constraints across the dependency graph.
The current documentation does not specify a consistent policy for handling such conflicts. Some releases fail immediately, others provide a warning, and a few attempt automatic resolution. This ambiguity complicates reproducible builds, especially in monorepo environments where multiple packages declare overlapping peer dependencies.
To design reliable CI pipelines, we need to understand the intended behavior and how it evolves across pnpm versions. The following questions remain unanswered:
When pnpm cannot satisfy a peer dependency constraint, it aborts the install and prints the error ERESOLVE unable to resolve dependency tree. This is the default, strict‑peer‑resolution policy that has been in place since pnpm 7.x and remains the same in the current stable v8.x releases.
The error message lists the two packages that cannot coexist, the required version ranges, and the installed versions that caused the clash. Example:
ERESOLVE unable to resolve dependency tree
│
├─ conflicting peer: react@^17.0.0 required by @mui/material@5.12.0
└─ installed: react@18.2.0
pnpm install --reporter ndjson to get structured JSON output.code equals ERESOLVE.details field to determine which packages are involved and why.If you intentionally want to ignore a conflict (e.g., for a quick prototype), you can:
--legacy-peer-deps—pnpm will continue with warnings.peerDependencies=auto in .npmrc to achieve the same effect across installs..nvmrc or package.json to a specific v8.x release.pnpm install --reporter ndjson and capture the output in a log file.ERESOLVE entries; if any exist, fail the CI job and surface the conflict details.pnpm install --legacy-peer-deps only in a “quick‑build” branch to test whether the conflict is benign.Check the peerDependencies of the conflicting packages and consider:
overrides in pnpm-workspace.yaml to force a single version of the peer.To tailor the recommendation to your setup, could you share the exact pnpm version you are using (e.g., pnpm@8.5.0)?
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.