Skip to content

Commit 26f6d4f

Browse files
benquarmbyzkochan
andauthored
fix: use npm co-located with the action node binary (#239)
* fix: use npm co-located with the action node binary * fix: resolve npm by absolute path; guard against unset PATH Follow-up to 5a9e198. Two refinements to the GHE self-hosted runner fix: - Spawn npm via `path.join(dirname(process.execPath), 'npm[.cmd]')` instead of relying on PATH lookup. This matches the original PR description and is robust against PATH-shadowed npm installations. - Avoid `"<dir>:undefined"` leaking into PATH when `process.env.PATH` is unset (rare, but possible in stripped environments). PATH still has the node directory prepended so npm's `#!/usr/bin/env node` shebang can resolve node on Linux/macOS. * fix: revert npm to PATH lookup; runner externals lacks npm Revert 42e75a1's switch to absolute-path npm resolution. The premise that npm is co-located with the action's node binary is false on GitHub-hosted runners: `process.execPath` points into `runner/externals/node24/bin/`, which contains node only — not npm. The absolute-path spawn produced ENOENT on Linux/macOS and "not recognized" on Windows. Go back to spawning `'npm'` and relying on PATH lookup, which works on standard runners (npm is on PATH from the runner image) and on the GHE self-hosted setup that motivated the original fix. Keep the node-directory prepend so npm's `#!/usr/bin/env node` shebang resolves, and keep the unset-PATH guard. --------- Co-authored-by: Zoltan Kochan <[email protected]>
1 parent 903f9c1 commit 26f6d4f

2 files changed

Lines changed: 46 additions & 35 deletions

File tree

0 commit comments

Comments
 (0)