简体   繁体   English

动态链接库(DLL)初始化例程在带有nodegit的电子中失败

[英]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: 试试这些:

  1. Make sure the packages are listed under the dependencies and not devDependencies in the package.json 确保软件包在package.json中的依赖项下列出,而不是devDependencies下

  2. 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 希望这可以帮助某人

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. 不过,最常见的问题是该组件未正确安装,因此某些依赖项不可用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 生成 electron 时动态链接库 (dll) 初始化例程失败 - a dynamic link library (dll) initialization routine failed when build electron 电子未捕获错误:动态链接库(DLL)初始化例程失败 - Electron Uncaught Error: A dynamic link library (DLL) initialization routine failed 电子在Windows上运行SQLlite 3 - 动态链接库(DLL)初始化例程失败 - Electron running SQLlite 3 on Windows - A dynamic link library (DLL) initialization routine failed NWJS - 动态链接库 (DLL) 初始化例程失败 - NWJS - A dynamic link library (DLL) initialization routine failed Azure函数-NodeJs-Sqlite-mscorlib-错误:动态链接库(DLL)初始化例程失败 - Azure Function - NodeJs - Sqlite - mscorlib - Error: A dynamic link library (DLL) initialization routine failed Electron 本机插件:DLL 初始化例程失败 - Electron native add on : DLL initialization routine failed 在 Electron 中运行 nodegit 失败 - Runing nodegit in Electron fails Nodegit和Electron无法一起工作 - Nodegit and Electron not working together 无法在动态链接库 api-ms-win-crt-runtime-l1-1-0.dll 中找到过程入口点 ucrtbase.terminate - procedure entry point ucrtbase.terminate could not be located in the dynamic link library api-ms-win-crt-runtime-l1-1-0.dll 在电子中使用.net dll - use .net dll in electron
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM