fix: use writable npm prefix to avoid EROFS on global npm installs#28384
fix: use writable npm prefix to avoid EROFS on global npm installs#28384Copilot wants to merge 3 commits into
Conversation
`npm install -g` without a custom prefix tries to write into `/opt/hostedtoolcache`, which is read-only on GitHub-hosted runners after `setup-node` completes. Fix by: 1. Setting `npm config set prefix /tmp/npm-global` before each global npm install and appending `/tmp/npm-global/bin` to `$GITHUB_PATH` so subsequent steps (including non-AWF mode) find the installed binary. 2. Prepending `/tmp/npm-global/bin` to the PATH constructed by `GetNpmBinPathSetup()` so AWF-wrapped execution steps (Crush, Claude, Codex, Gemini, OpenCode) also find the binary inside the container. Affects all engines that use `npm install -g` (Crush, Claude, Codex, Gemini, OpenCode). Recompile regenerates all 201 lock files. Agent-Logs-Url: https://github.com/github/gh-aw/sessions/25bf0aec-23d9-499f-9c5b-54365990ef30 Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
|
@copilot use RUNNER_TEMP location |
Agent-Logs-Url: https://github.com/github/gh-aw/sessions/d36abba2-d7ee-4bf6-9721-751794c511b9 Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Done in f49480e. The npm prefix and the PATH setup in Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
Hey The checklist came back clean:
Nothing blocking here — this is aligned with contribution guidelines and looks ready for review once the draft is marked ready.
|
npm install -gdefaults to writing into/opt/hostedtoolcache/node/.../lib/node_modules/, which is read-only afteractions/setup-noderuns on GitHub-hosted runners — causing an immediate EROFS failure for any engine that installs its CLI this way (Crush, Claude, Codex, Gemini, OpenCode).Changes
GenerateNpmInstallStepsWithScope— global installs now set a writable prefix using$RUNNER_TEMP(the official GitHub Actions temp directory) and register the bin dir:GetNpmBinPathSetup— prepends${RUNNER_TEMP:-/tmp}/npm-global/binto the PATH used inside AWF-wrapped execution containers, so the binary is found in both firewall and non-firewall modes:The
/tmpfallback handles AWF container contexts whereRUNNER_TEMPmay not be inherited from the host runner.Updated
TestGetNpmBinPathSetupto assertRUNNER_TEMP-basednpm-global/binappears before/opt/hostedtoolcachein the generated PATH.All 201 lock files recompiled.