Skip to content

Commit 278df04

Browse files
reggiCopilot
andauthored
chore: pass nodedir to node-gyp via npm_package_config env in node integration (#9822)
## What / Why The `node-integration` workflow passed `--nodedir` as an npm **CLI flag** to `npm install`. In npm 12 unknown configs are no longer accepted, so this now fails with `EUNKNOWNCONFIG`: ``` npm error code EUNKNOWNCONFIG npm error Unknown cli flag: npm error - --nodedir ``` (seen in the Release Integration citgm jobs, e.g. `citgm - bcrypt@6.0.0`). `nodedir` is a **node-gyp** option, not an npm config — it only ever worked via npm's old "accept arbitrary config and re-export as `npm_config_*`" behavior, which node-gyp itself notes was deprecated in npm v11 ([nodejs/node-gyp#3156](nodejs/node-gyp#3156)). ## Change Export `npm_package_config_node_gyp_nodedir` instead of using the CLI flag. This is node-gyp's preferred prefix since npm v11: node-gyp reads it directly from the environment, and npm does **not** warn on it — unlike `npm_config_nodedir`, which currently warns and is slated to error in npm 13. This also matches how upstream [nodejs/citgm](https://github.com/nodejs/citgm) supplies `nodedir` (via env, not a CLI flag). Applied to both the generated `.github/workflows/node-integration.yml` and its `scripts/template-oss/node-integration-yml.hbs` template; `template-oss-apply --lint` passes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 6e300b82-303b-49ac-ae93-52d984743d5b
1 parent b888cc9 commit 278df04

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

.github/workflows/node-integration.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,8 @@ jobs:
407407
working-directory: ${{ steps.download.outputs.target }}
408408
run: |
409409
set +e
410-
npm install --nodedir="${{steps.install.outputs.nodedir }}" ${{ matrix.install_flags }}
410+
export npm_package_config_node_gyp_nodedir="${{ steps.install.outputs.nodedir }}"
411+
npm install ${{ matrix.install_flags }}
411412
exitcode=$?
412413
if [[ $exitcode -ne 0 && "${{ matrix.knownFailure }}" == "true" ]]; then
413414
echo "::warning ::npm install failed, exit $exitcode"
@@ -445,7 +446,7 @@ jobs:
445446
FINALEXIT=0
446447
STEPEXIT=0
447448
448-
export npm_config_nodedir="${{ steps.install.outputs.nodedir }}"
449+
export npm_package_config_node_gyp_nodedir="${{ steps.install.outputs.nodedir }}"
449450
450451
# inlining some patches to make tests run
451452
if [[ "${{ matrix.package }}" == "undici" ]]; then

scripts/template-oss/node-integration-yml.hbs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,8 @@ jobs:
405405
working-directory: $\{{ steps.download.outputs.target }}
406406
run: |
407407
set +e
408-
npm install --nodedir="$\{{steps.install.outputs.nodedir }}" $\{{ matrix.install_flags }}
408+
export npm_package_config_node_gyp_nodedir="$\{{ steps.install.outputs.nodedir }}"
409+
npm install $\{{ matrix.install_flags }}
409410
exitcode=$?
410411
if [[ $exitcode -ne 0 && "$\{{ matrix.knownFailure }}" == "true" ]]; then
411412
echo "::warning ::npm install failed, exit $exitcode"
@@ -443,7 +444,7 @@ jobs:
443444
FINALEXIT=0
444445
STEPEXIT=0
445446

446-
export npm_config_nodedir="$\{{ steps.install.outputs.nodedir }}"
447+
export npm_package_config_node_gyp_nodedir="$\{{ steps.install.outputs.nodedir }}"
447448

448449
# inlining some patches to make tests run
449450
if [[ "$\{{ matrix.package }}" == "undici" ]]; then

0 commit comments

Comments
 (0)