Open CMCDragonkai opened 2 years ago
I see, what about the need to explicitly set the --target
in prebuildify that seems inconsistent with how node-gyp
automatically knows the right version.
I see, what about the need to explicitly set the
--target
in prebuildify that seems inconsistent with hownode-gyp
automatically knows the right version.
prebuildify
is geared towards Node-API, so the version of the executing node process is not necessarily the right version. It defaults to compiling against the latest node version (relying on backwards compatibility of Node-API, assuming that NAPI_VERSION
is defined appropriately). You can also choose to compile against the minimum node version (relying on forwards compatibility, and not necessarily having to define NAPI_VERSION
).
I don't know if there's a practical difference between these options though (because Node-API has delivered on their promise of compatibility, and defining NAPI_VERSION
is a best practice in any case). It might just be that there is no good default for prebuildify
, or better said, from a "glass half full" perspective, that any of these options would work as a default for the majority of users.
Furthermore on Linux, once I have
nodedir
set,prebuildify
doesn't put anything in/tmp/prebuildify
, it only does it on Windows.
The Linux behavior is as expected because setting nodedir
tells node-gyp
to use your own node source code instead of downloading headers from an official node version. How/where are you setting nodedir
on Windows?
I wasn't setting nodedir on windows. Maybe that's the reason?
Windows nodejs installation by default doesn't come with headers.
So it seems it requires headers and also this thing called node.lib. Not sure what that is.
I wasn't setting nodedir on windows. Maybe that's the reason?
Yeah, that's it.
It shouldn't be necessary to set nodedir
unless you want to build against a fork of node (or a specific commit of node).
I've been trying out
prebuildify
on Windows, and I noticed it has its own node headers and node.lib cache.For example:
Is the node-gyp cache. While
Is prebuildify's node cache.
Considering that many packages are using
node-gyp-install
as their install script, their cache is likely populated by node-gyp automatically, why is prebuildify then creating its own cache?I also noticed that node-gyp will automatically fill the target with the current node version. But prebuildify doesn't. Even when
node-gyp
was using 16.14.2, prebuildify defaulted to 18.0.0, I had to explicitly set the--target=16.14.2
when using prebuildify to ensure it was using the same.Furthermore on Linux, once I have
nodedir
set,prebuildify
doesn't put anything in/tmp/prebuildify
, it only does it on Windows.