Infer `nodedir` for headerfiles from execPath
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 10.7k
- Forks
- 1.9k
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 5
Description
- Node Version: latest 18 / 20
- Platform: Linux arm64/x86_64
- Compiler: gcc
- Module: anything
(Didn't follow for the format as this is a general capability request, for any version)
Following from https://github.com/nodejs/node-gyp/issues/812 and reading through some of the code in lib/configure.js and https://github.com/nodejs/node-gyp/blob/main/lib/find-node-directory.js, could the general strategy of inferring the nodedir through a traversal from process.execPath work to automatically find headers files even when using non-standard installation locations of node?
In other words, infer the npm_config_nodedir from the execPath, instead of requiring users set it explicitly:
export npm_config_nodedir="/my/node/install/path/18.x.x/"
node-gyp ...
My main hesitation is I don't know if this could accidentally end up with false-positive identification in a lot of the cases for some reason, or otherwise break some ecosystem usage. It could also be behind a flag or variable like --infer-nodedir / npm_config_infer_nodedir if that's a concern, though of course preferably it could be a default.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading lib/configure.js and lib/find-node-directory.js, then trace how npm_config_nodedir is currently obtained and used. Determine whether traversing from process.execPath can reliably locate Node headers without false positives; done means the project has an agreed implementation scope and verification for standard and non-standard installations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100