Closed robosushie closed 1 month ago
Please create github repo to show the problem, it is hard to say why module was not found
Okay
You can use this repository https://github.com/robosushie/repro.git To repro ... npm run package / npm run make copy the generated output distributable to another pc and then run the exe file.
Thanks and Regards Sushant
I have also tried the options mentioned in this comment https://github.com/webpack-contrib/node-loader/issues/12#issuecomment-334116820 but still got the same issue when testing it on a different module.
I have also tried other configuration options with node-loader and node-bindings-loader, https://github.com/webpack-contrib/node-loader/issues/22#issuecomment-652946395
I dont know what exactly wrong I am doing wrong. Regards Sushant
I have the problem with your example:
make: Entering directory '/home/evilebottnawi/IdeaProjects/repro/build'
make: *** No rule to make target 'Release/obj.target/libsdr//home/evilebottnawi/IdeaProjects/repro/addon/libsdr.o', needed by 'Release/obj.target/sdr.node'. Stop.
make: Leaving directory '/home/evilebottnawi/IdeaProjects/repro/build'
:disappointed:
When are you seeing issue? which command are you running?
I actually generated this project using the command "npx create-electron-app --template=webpack".
In this I have only addon the addon, external, jsconfig.json and bindings.gyp, and called the addon in main file.... The template had prebuild options with node-loader and @marshallofsound/webpack-asset-relocator-loader ... in webpack.rules.js file... it was also not working with the default configs... So I then tried looking in forums and tested with "native-ext-loader", "node-bindings-loader", "awesome-node-loader" but nothing worked.
I found two similar issues, and followed the methods they mentioned, but those were also not working https://github.com/electron-react-boilerplate/electron-react-boilerplate/issues/1258 https://github.com/webpack/webpack/issues/5762 https://github.com/webpack-contrib/node-loader/issues/12#issuecomment-334116820
I did not see this in my setup, can you try with node-gyp rebuild and then package it?
If you use webpack-asset-relocator-loader
, you don't need node-loader
, just remove it and use process.dlopen
Okay, I think both are necessary because this is currently mentioned in electron-forge documentation.
I will try with webpack-asset-relocator-loader and add process.dlopen and test it. Thanks
Resolved
I have a basic electron project with cpp addons, build using the electron-forge -webpack template. When I packaging the project into an exe. It is working on the system the exe was generated but when copying and testing on another computer it is showing error that the .node file is not found by node-loader
I tried to run "electron-forge make" and run the installer and then tested the app, same error was comming.
Whereas the .node file is located in the same location
I am calling the node module in my main.js file using the bindings library and I am also using node-bindings-loader to manage the bindings path.
const addon = require("bindings")("libsdr.node");
My package.json file
My webpack.main.config.js
Any help would be appreciated. I have also tried may other combinations with other node loaders also but none of them worked.