setup-node
setup-node copied to clipboard
Cannot install packages using Node.js 22 on windows-latest runners
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
Hello @lpsinger, Thank you for creating this issue and we will look into it :)
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.
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
This is a problem with Node itself https://github.com/nodejs/node/issues/52682
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
Yes, indeed. Thanks!