[英]A dynamic link library (DLL) initialization routine failed in electron with nodegit
When I use nodegit in electron, I got the error when I start the app: 当我在电子中使用nodegit时,启动应用程序时出现错误:
App threw an error during load 应用在加载期间引发错误
Error: A dynamic link library (DLL) initialization routine failed. 错误:动态链接库(DLL)初始化例程失败。
\\?\\D:\\Electron\\hello\\node_modules\\nodegit\\build\\Release\\nodegit.node \\ \\ d:\\电子\\你好\\ node_modules \\ nodegit \\建立\\发布\\ nodegit.node
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:166:20) 在process.module。(匿名函数)[作为dlopen](ELECTRON_ASAR.js:166:20)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:740:18) 在Object.Module._extensions..node(内部/模块/cjs/loader.js:740:18)
... ...
I can use nodegit in nodejs successfully, but failed in electron. 我可以在nodejs中成功使用nodegit,但在电子方面却失败。
Even I added .npmrc file with content below, it's still faield. 即使我添加了.npmrc文件,其内容如下,仍然很笨拙。
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 我的环境是Windows 10 x64 with vs 2017,节点10.13,电子3.010
I had the same problem with another node package using electron 3.0.6 and eventually got it working. 我在另一个使用电子3.0.6的节点包中遇到了同样的问题,并最终使其工作。
Try these: 试试这些:
Make sure the packages are listed under the dependencies and not devDependencies in the package.json 确保软件包在package.json中的依赖项下列出,而不是devDependencies下
Add this "electron-rebuild --force node-gyp rebuild --target=3.0.6 --arch=x64" to postinstall under the scripts section. 将此“电子重建--force node-gyp重建--target = 3.0.6 --arch = x64”添加到脚本部分下的后安装。 I ended up with this in my packages.json (my DLL error was for "printer") 我最终在我的packages.json中找到了这个(我的DLL错误是由“打印机”引起的)
{ "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 希望这可以帮助某人
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.