Reputation: 469
When I use nodegit in electron, I got the error when I start the app:
App threw an error during load
Error: A dynamic link library (DLL) initialization routine failed.
\?\D:\Electron\hello\node_modules\nodegit\build\Release\nodegit.node
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:166:20)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:740:18)
...
I can use nodegit in nodejs successfully, but failed in electron.
Even I added .npmrc file with content below, it's still faield.
runtime = electron
target = 1.2.8
target_arch = x64
disturl = https://atom.io/download/atom-shell
Does anyyone know how to fix it in electron? My environment is windows 10 x64 with vs 2017, node 10.13, electron 3.010
Upvotes: 2
Views: 2865
Reputation: 489
First confirm if global node version matches with the project one. Some projects require specific version hence first delete other node and install required node version and project dependencies. Try below solutions to solve the errors as same worked for me
yarn electron-rebuild
. For more info on yarn refer " https://www.digitalocean.com/community/tutorials/how-to-install-and-use-the-yarn-package-manager-for-node-js "Upvotes: 1
Reputation: 284
From this link:
The most common issue though is that the component was not properly installed, so that some of its dependencies are not available.
Upvotes: 0
Reputation: 638
I had the same problem with another node package using electron 3.0.6 and eventually got it working.
Try these:
Make sure the packages are listed under the dependencies and not devDependencies in the package.json
Add this "electron-rebuild --force node-gyp rebuild --target=3.0.6 --arch=x64" to postinstall under the scripts section. I ended up with this in my packages.json (my DLL error was for "printer")
{
"name": "myproject",
"version": "1.0.0",
"main": "main.js",
"scripts": {
"postinstall": "electron-rebuild --force node-gyp rebuild --target=3.0.6 --arch=x64",
"start": "electron ."
},
"dependencies": {
"@types/node": "^10.12.18",
"electron-rebuild": "1.8.2",
"electron": "3.0.6",
"printer": "0.2.2"
},
"devDependencies": {
...
}
}
See here for more info
Hope this helps someone
Upvotes: 0