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 2 months ago • 4 comments

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