GeezerVison is showing github.com — Npm Dependency Installation Fails with `ERESOLVE unable to resolve dependency tree` · Issue #2448 · diffplug/spotless
Npm Dependency Installation Fails with ERESOLVE unable to resolve dependency tree #2448
Description
After we increase the version of prettier in our projects, developers sometimes cannot use spotless at all. They get lint errors on formatted files, informing them that the npm install failed:
There were 39 lint error(s), they must be fixed or suppressed.
build/<path to SQL file>:LINE_UNDEFINED prettier-format(com.diffplug.spotless.npm.NpmProcessException) Running npm command 'NpmInstall in <project path>/build/spotless-prettier-node-modules-edd532637edcb6904b3d70deaa4ddaa0 [<project path>/.gradle/nodejs/node-v22.14.0-darwin-arm64/bin/npm install --no-audit --no-fund --prefer-offline]' failed with exit code: 1
Reproducing the command spotless runs reveals the error by npm spotless is facing:
npm install error
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: [email protected]
npm error Found: prettier@undefined
npm error node_modules/prettier
npm error dev prettier@"3.4.2" from the root project
npm error
npm error Could not resolve dependency:
npm error peer prettier@"^3.0.3" from [email protected]
npm error node_modules/prettier-plugin-sql
npm error dev prettier-plugin-sql@"0.18.1" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error
npm error For a full report see:
npm error <user home>/.npm/_logs/2025-03-14T09_43_53_020Z-eresolve-report.txt
npm error A complete log of this run can be found in: <user home>/.npm/_logs/2025-03-14T09_43_53_020Z-debug-0.log
The root problem is that npm needs to update its package information, but doesn’t do that when --prefer-offline is set. Spotless already has logic for such a case, but the detection for when to apply that logic does not include this case, yet.
Activity
added a commit that references this issue
on Mar 14, 2025This issue will close once commit 557d983 is merged into the 'main' branch.557d983 nedtwigg commented on Apr 8, 2025
Published in plugin-gradle 7.0.3 and plugin-maven 2.44.4
Metadata
Metadata
Development
No branches or pull requestsIssue actions