Verify latest release
pnpm version
Reproduced on 12.7.0. 11.28.0 sets the variable for the same script.
Which area(s) of pnpm are affected? (leave empty if unsure)
CLI, installation
Reproduction steps
In a directory containing
package.json
{
"name": "probe",
"version": "1.0.0",
"private": true,
"scripts": {
"dump": "node print-node-gyp.js"
}
}
print-node-gyp.js
console.log(`npm_config_node_gyp=<${process.env.npm_config_node_gyp ?? 'unset'}>`)
run
Describe the Bug
pnpm run and the lifecycle scripts pnpm executes never see npm_config_node_gyp, so scripts read unset:
| Command |
pnpm 11.28.0 |
pnpm 12.7.0 |
pnpm run dump |
the bundled node-gyp entry point |
unset |
The TypeScript CLI fills the variable with its bundled node-gyp entry point whenever the environment does not set it, and #11116 kept npm_config_node_gyp as one of the well-known npm_* variables lifecycle scripts receive, matching Yarn.
The Rust CLI has the same mechanism, but it is not wired up: ScriptEnvironment::node_gyp_path is the field written into npm_config_node_gyp by stamp_executables, and every call site passes None. Tools that read the variable (the node-pre-gyp family, for example) therefore resolve a different node-gyp under pnpm 12 than under pnpm 11 or Yarn.
Expected Behavior
Scripts see the same npm_config_node_gyp under pnpm 12 that pnpm 11 and Yarn give them: the bundled node-gyp entry point when the environment has no value, and the inherited value when it does.
Which Node.js version are you using?
24.x
Which operating systems have you used?
Additional
A fix is prepared and will be submitted as a PR shortly.
Written by an agent (Kimi Code).
Verify latest release
pnpm version
Reproduced on
12.7.0.11.28.0sets the variable for the same script.Which area(s) of pnpm are affected? (leave empty if unsure)
CLI, installation
Reproduction steps
In a directory containing
package.json{ "name": "probe", "version": "1.0.0", "private": true, "scripts": { "dump": "node print-node-gyp.js" } }print-node-gyp.jsrun
pnpm run dumpDescribe the Bug
pnpm runand the lifecycle scripts pnpm executes never seenpm_config_node_gyp, so scripts readunset:pnpm run dumpnode-gypentry pointunsetThe TypeScript CLI fills the variable with its bundled
node-gypentry point whenever the environment does not set it, and #11116 keptnpm_config_node_gypas one of the well-knownnpm_*variables lifecycle scripts receive, matching Yarn.The Rust CLI has the same mechanism, but it is not wired up:
ScriptEnvironment::node_gyp_pathis the field written intonpm_config_node_gypbystamp_executables, and every call site passesNone. Tools that read the variable (thenode-pre-gypfamily, for example) therefore resolve a differentnode-gypunder pnpm 12 than under pnpm 11 or Yarn.Expected Behavior
Scripts see the same
npm_config_node_gypunder pnpm 12 that pnpm 11 and Yarn give them: the bundlednode-gypentry point when the environment has no value, and the inherited value when it does.Which Node.js version are you using?
24.x
Which operating systems have you used?
Additional
A fix is prepared and will be submitted as a PR shortly.
Written by an agent (Kimi Code).