Skip to content

fix: use npm co-located with the action node binary#239

Open
benquarmby wants to merge 1 commit intopnpm:masterfrom
benquarmby:fix/npm-path-ghe-runners
Open

fix: use npm co-located with the action node binary#239
benquarmby wants to merge 1 commit intopnpm:masterfrom
benquarmby:fix/npm-path-ghe-runners

Conversation

@benquarmby
Copy link
Copy Markdown

Fixes #234spawn npm ENOENT on GHE self-hosted runners where npm is not on PATH.

Root cause

#212 introduced npm ci as the bootstrap mechanism. On standard GitHub-hosted runners npm is on PATH; on GHE self-hosted runners it is not guaranteed to be present.

Fix

  • Resolve npm via join(dirname(process.execPath), 'npm'[.cmd]) — npm is always co-located with the node binary that runs the action
  • Prepend dirname(process.execPath) to the child PATH so npm's #!/usr/bin/env node shebang can resolve node

Test plan

  • GHE self-hosted runner without npm on PATH
  • Standard GitHub-hosted Linux, macOS, and Windows runners

Comment thread src/install-pnpm/run.ts Outdated
@benquarmby benquarmby force-pushed the fix/npm-path-ghe-runners branch from ec0592c to 5a9e198 Compare April 27, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v6 fails if npm does not exist on the runner (GHE)

1 participant