I built my own NodeJs Module with node-addon-api in C++ and now I want to use it in an electron.js app. But unfortunetly stuck with can not find module error.
My project structure is like the following:
/
/build
/Release
myAddon.node
/node_modules
binding.gyp
index.js
index.html
package.json
package-lock.json
The node-gyp build runs without failures and the module is in the /build/Release folder.
Now I want to load the module in my index.js file with
const myAddon = require('./build/Release/myAddon.node)
And when I start the app it fails with
Error: Cannot find module
\\?\Path\To\MyProject\build\Release\myAddon.node
The path in the error message is correct and the .node file is there. Is there any further configuration or setting which I have forgotten?
Here is the output with the bindings addon:
App threw an error during load
Error: Could not locate the bindings file. Tried:
And then there is a list with some folders it has tried to find it. But none of these folders exists in my project.