setup-node icon indicating copy to clipboard operation
setup-node copied to clipboard

Cannot install packages using Node.js 22 on windows-latest runners

Open lpsinger opened this issue 1 year ago • 4 comments
trafficstars

Description: If you set node-version to 22 on a GitHub-hosted windows-latest runner, commands like npm ci fail with the following error message:

node:internal/modules/cjs/loader:1205
  throw err;
  ^
Error: Cannot find module 'C:\npm\prefix\node_modules\npm\bin\npm-cli.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1202:15)
    at Module._load (node:internal/modules/cjs/loader:1027:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:187:14)
    at node:internal/main/run_main_module:28:49 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
Node.js v22.0.0

Action version: v4

Platform:

  • [ ] Ubuntu
  • [ ] macOS
  • [x] Windows

Runner type:

  • [x] Hosted
  • [ ] Self-hosted

Tools version: node: v22.0.0 npm: 10.5.1 yarn: 1.22.22

Repro steps:
See https://github.com/lpsinger/nodejs-22-windows

Expected behavior: Build should pass

Actual behavior: Build fails. See this workflow run: https://github.com/lpsinger/nodejs-22-windows/actions/runs/8881922941/job/24385408488

lpsinger avatar Apr 29 '24 16:04 lpsinger

Hello @lpsinger, Thank you for creating this issue and we will look into it :)

aparnajyothi-y avatar Apr 30 '24 13:04 aparnajyothi-y

I believe I'm having the same issue here: https://github.com/express-rate-limit/express-rate-limit/actions/runs/8900764596/job/24445327662 - that commit was a documentation-only change and the previous build passed.

It runs on nodejs 16 + the latest LTS (currently 20) + the latest release (currently 22). This failure happened with node.js v22.0.0 & npm 10.5.1.

nfriedly avatar Apr 30 '24 20:04 nfriedly

I'm having the same issue, any ideas on a eta to fix this will block all my windows builds that need to use node 22

Inrixia avatar May 01 '24 06:05 Inrixia

This is a problem with Node itself https://github.com/nodejs/node/issues/52682

wolfy1339 avatar May 01 '24 19:05 wolfy1339

Looks like this is now fixed with node.js 22.1.0 and npm 10.7.0 - https://github.com/express-rate-limit/express-rate-limit/actions/runs/8900764596

nfriedly avatar May 06 '24 14:05 nfriedly

Yes, indeed. Thanks!

lpsinger avatar May 06 '24 14:05 lpsinger