Commit 278df04
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-52d984743d5b1 parent b888cc9 commit 278df04
2 files changed
Lines changed: 6 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
407 | 407 | | |
408 | 408 | | |
409 | 409 | | |
410 | | - | |
| 410 | + | |
| 411 | + | |
411 | 412 | | |
412 | 413 | | |
413 | 414 | | |
| |||
445 | 446 | | |
446 | 447 | | |
447 | 448 | | |
448 | | - | |
| 449 | + | |
449 | 450 | | |
450 | 451 | | |
451 | 452 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
405 | 405 | | |
406 | 406 | | |
407 | 407 | | |
408 | | - | |
| 408 | + | |
| 409 | + | |
409 | 410 | | |
410 | 411 | | |
411 | 412 | | |
| |||
443 | 444 | | |
444 | 445 | | |
445 | 446 | | |
446 | | - | |
| 447 | + | |
447 | 448 | | |
448 | 449 | | |
449 | 450 | | |
| |||
0 commit comments