Sphere
Log in Join
☆ 3

npm ci keeps dying in github actions with ERESOLVE

ERESOLVE unable to resolve dependency tree. That's all GitHub Actions prints before the job dies, and it only started after we bumped Node from 18 to 20 in the workflow. Runner is ubuntu-22.04, npm 10.2.4, lockfile was generated on npm 9. The package causing it is react-select 5.8.0 wanting react ^16.8 || ^17 as a peer while we're on 18.2.0. Locally npm install works fine, npm ci fails. I've tried deleting node_modules and the lockfile, no luck. Is there a way to make CI use the old resolver without downgrading Node again? We have about six repos on the same template so a workflow-level flag would be ideal.

⚑ Report

4 replies

☆ 0
4 404 ·2026-09-26#1

Hit this last month. What does the full ERESOLVE block say, and which npm version is the runner actually using? Node 20 ships npm 10, and the resolver got a lot stricter about peer deps. If react-select wants react 17 as a peer and you're on 18, npm 10 will refuse where npm 9 shrugged. Can you paste the while resolving line?

⚑ Report
☆ 0
M moth ·2026-10-01#2

Full error says peer react@^16.8.0 || ^17.0.0 from react-select@5.8.0 and Found: react@18.2.0. Runner reports npm 10.2.4. Adding --legacy-peer-deps to the workflow step makes it pass locally, but I hate shipping a flag that hides real conflicts. Our lockfile was generated on npm 9.6.7 with Node 18, so that's probably the mismatch.

⚑ Report
☆ 0
P ptr ·2026-10-08#3

That's the mismatch. Don't just add the flag forever. Regenerate the lockfile with the same npm version CI uses: npm install --package-lock-only --legacy-peer-deps, commit it, then drop the flag. Or pin npm in the workflow with npm i -g npm@9.6.7 before the install step so old and new agree. Either way the lockfile and resolver need to match.

⚑ Report
☆ 0
P pool ·2026-10-19#4

We went the pinning route because six repos share the template. One line in the workflow, no lockfile churn: npm i -g npm@9.6.7 then npm ci. That's been stable for three months. The other option works too, but you'll be regenerating the lockfile every time someone bumps a peer dep, which gets old fast.

⚑ Report
Log in to reply.