Wednesday, 18 September 2019

node-gyp precompile hook?

First and foremost, I am writing a cross platform electron app, however I believe my issue to be node related.I had been using a preinstall hook in my library's package.json that rans a build.js build script through node. This builds core C++ libs for the project so that when I run 'node-gyp configure build --verbose' as the install script, node-gyp links to the libraries that are built via the preinstall. However in the electron app's package.json I need to run a postinstall script, "electron-rebuild" to ensure that the node module is compiled to match the electron version. electron-rebuild then completely nukes the build folder, and obviously won't run the lib packages preinstall hook.I found a way around this problem, and it works without a hitch on Windows (surprisingly), but it introduces a slew of other issues for the Linux build. Instead of a preinstall script in the lib package, I am attempting to add a node-gyp target in the bindings.gyp that runs the build.js file via `node build.js`. On windows, it runs just fine. On linux, node-gyp is unable to locate the node executable. I can confirm my linux machine has node installed, as I can call `node build.js` directly, but the moment it is called via node-gyp, it fails as node cannot be found.Does anyone have any ideas on how to properly run this build.js as a part of the binding.gyp in a cross-platform way?Github Libs (npm)Github App (npm)Any help would be appreciated as I am at my wits end with trying to use node 😅

Submitted September 18, 2019 at 05:18PM by incomingstick

No comments:

Post a Comment