Replies: 2 comments 3 replies
|
You can set it in # .npmrc
nodedir=/path/to/your/node/sourcepnpm (and npm) reads If you need it per-project, put the For the broader question about an env var allowlist: there's |
|
It looks like pnpm 11.20.0 now provides a project-level way around this, without patching You can use the // .pnpmfile.cjs
module.exports = {
hooks: {
updateConfig(config) {
config.extraEnv = {
...config.extraEnv,
npm_config_nodedir: '/path/to/node',
}
return config
},
},
}Use the same pnpm rebuild re2
So the important version check is: pnpm --versionThis needs pnpm 11.20.0 or newer. On an older pnpm 11 release, your current patch or an explicit |
Uh oh!
There was an error while loading. Please reload this page.
Since pnpm 11, only a limited set of environment variables are passed to lifecycle scripts. See https://pnpm.io/scripts#environment-variables
I am trying to build a project that uses re2 in a sandboxed/air-gapped environment. In previous versions, I would just set
npm_config_nodedirto my local clone of the Node.js source, to allow node-gyp to build without internet access. Due to pnpm 11 filtering these environmnt variables, this does not work anymore.I thought I could use a package patch to inject this using a custom env var, but that obviously doesn't scale well.
I think it should be possible to configure an allowlist for these kinds of environment variables.
All reactions