Not able to find dependency (node-pre-gyp) with electron, using electron-builder

343 Views Asked by At

I'm using electron and one of my dependencies is using node-pre-gyp for prebuilding some node native modules.

Node-pre-gyp is not working properly with webpack, so I decided to import my library to use it as external.

Everything works fine locally, but if I try to create a package with electron-builder it's not able to find node-pre-gyp, apparently electron-build removes the node modules, so my app is not able to use it.

I tried adding it to the "files" configuration for electron builder with no luck.

1

There are 1 best solutions below

0
On

I solved the issue switching from node-pre-gyp to prebuildify.

Another alternative I found is to specifically set the required dependencies in the package.json that I was using for electron, but that was something I was trying to avoid, since it was a dependency of my backend (fork spawned from the main process).