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.
(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 thenodedir
through a traversal fromprocess.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 theexecPath
, instead of requiring users set it explicitly: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.