Skip to content

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

Description

@lpsinger

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
  • Windows

Runner type:

  • 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions