-
Notifications
You must be signed in to change notification settings - Fork 506
Closed
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: spotless-prettier@2.0.0
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 prettier-plugin-sql@0.18.1
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.
Metadata
Metadata
Assignees
Labels
No labels