Skip to content

fix: print ERESOLVE for dense dependents graphs instead of exiting silently - #9988

Open
manzoorwanijk wants to merge 1 commit into
npm:latestfrom
manzoorwanijk:fix/eresolve-report-dedupe-shared-dependents
Open

manzoorwanijk wants to merge 1 commit into
npm:latestfrom
manzoorwanijk:fix/eresolve-report-dedupe-shared-dependents

Conversation

@manzoorwanijk

@manzoorwanijk manzoorwanijk commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

When an ERESOLVE conflict involved a package with many shared workspace dependents, npm exited 1 printing only the log file path. The full eresolve-report.txt is rendered at depth = Infinity, and explainFrom re-expanded shared ancestors on every path, so the report grew exponentially until it threw RangeError: Invalid string length. That throw escaped #getError in lib/npm.js before anything was printed.

Changes

  • At unlimited depth, each dependent is expanded once and later occurrences are marked deduped, like npm ls. Output at limited depth, as printed in the terminal, is unchanged.
  • If the error formatter throws, npm now prints the original error code and message, and keeps its exit code and --json summary.

With 30 workspaces the report is 17 KB and the ERESOLVE message is printed. Before, npm crashed with no message; at 28 workspaces the report was already 400 MB.

References

Fixes #9978

@manzoorwanijk
manzoorwanijk marked this pull request as ready for review September 15, 2026 10:11
@manzoorwanijk
manzoorwanijk requested a review from a team as a code owner September 15, 2026 10:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] ERESOLVE in a workspace graph with shared dependents exits 1 with no error message

1 participant