Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Windows 10: A dynamic link library (DLL) initialization routine failed. #51

Closed
McPo opened this issue Oct 18, 2016 · 15 comments
Closed
Labels
electron-rebuild Issues related to how keytar is compiled in a project that also uses electron-rebuild

Comments

@McPo
Copy link

McPo commented Oct 18, 2016

Attempting to run the application and am greeted immediately with this error.

ELECTRON_ASAR.js:158 Uncaught Error: A dynamic link library (DLL) initialization routine failed.
?\C:\Users\Emmet\Sources\xxxxxxxxxxxx\src\node_modules\keytar\build\Release\keytar.node

Let me know if theres any more info needed.

@McPo
Copy link
Author

McPo commented Oct 20, 2016

Despite having the same Node (6.1.0) version as Electron (1.2.3). I had to install electron-rebuild and execute it on post install. I also was using electron-builder which uses two separate package.json files.

"scripts": {
"postinstall": "cd ../ && "./node_modules/.bin/electron-rebuild" -m ./src/node_modules/ -w keytar -p -f"
}

-f forces a rebuild, -p applies a relevant pre-gyp-fix and m specifies to use the inner node_modules, while obtaining the electron-prebuilt from the outer node_modules.

Still not sure why this is required though.

@gitmitch
Copy link

gitmitch commented Nov 2, 2016

@McPo I'm thinking about using node-keytar for my Electron app, but this may be a blocker if I understand this issue correctly. To employ the workaround you found, it sounds like my Windows user would need Visual Studio installed because electron-rebuild would be run as the last step of the installer on their machine. Am I understanding this issue correctly?

@McPo
Copy link
Author

McPo commented Nov 2, 2016

I had to use electron-rebuild to get it working in Windows 10 (And I believe electron-rebuild requires Visual Studios).

However when I built it on Windows 10 it worked fine on Windows 7. So you could just rebuild the module and then store the binaries in another folder and have a post-install hook to copy your prebuilt binary over the one that its shipped with.

You might also be able to get away with just the msbuild tools, and if you need a copy of Windows to do the initial compilation. These VMs from Microsoft work well https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/

Basically, it shouldn't be a blocker, just an initial inconvenience, and the tools look well across the platforms.

@endercrest
Copy link

Just wanted to confirm, the electron-rebuild solves the problem with windows 10.

@gengjiawen
Copy link

I run into this problem with Node 8.4.0, Node 7 is fine.

@manuelbieh
Copy link

manuelbieh commented Nov 8, 2017

I ran electron-rebuild 20x now with different options, I just don't get it working on Win 10 (Pro), with Fall Creators Update and Electron 1.7.8 / 1.8.1. Keep getting the A dynamic link library (DLL) initialization routine failed error no matter what I do ... My node version is 8.9.0.

@kspearrin
Copy link

@manuelbieh Did you ever get this working? I'm having same issue. ./node_modules/.bin/electron-rebuild -w keytar -p -f doesn't seem to work.

@invokablegmbh
Copy link

do you have electron-rebuild installed?
try to issue "npm install electron-rebuild" before executing "./node_modules/.bin/electron-rebuild"

@RyanRizzo96
Copy link

@jarmediagmbh, this solved my problem! Thanks! 💯

@roqvist
Copy link

roqvist commented May 29, 2018

I tried everything in this thread, rebuilding with electron-rebuild doesn't seem to help. Still getting the DLL initialization routine failed error.

Did anyone get this working on Windows 10?

@TomasHubelbauer
Copy link

For the record I did also struggle with statically referencing the dependency on Windows 10 and eventually just gave up to try dynamically referencing it, but also ran into issues with that (#106).

@H3npi
Copy link

H3npi commented Jun 19, 2018

When i run electron-rebuild the dev version works, however when i pack the application using electron-packager it is not working.

@m-o-leary
Copy link

I am also having this issue and am not clear from this thread how exactly to fix it, can someone post a step by step on how to fix with commands included?

Thanks

@fcapolini
Copy link

I am also having this issue and am not clear from this thread how exactly to fix it, can someone post a step by step on how to fix with commands included?

Thanks

I had the same problem and published a little how-to here.

Hope this helps

@shiftkey shiftkey added the electron-rebuild Issues related to how keytar is compiled in a project that also uses electron-rebuild label Jan 21, 2019
@shiftkey
Copy link
Contributor

Closing this out because I think all that we can do currently is:

  • publish prebuild targets that support as much as possible (currently ever major version from Node 6 to Node 12 and Electron 1.6 to Electron 5) to save people building native modules when unnecessary
  • continue to point to the upstream Electron docs about native Node modules and electron-rebuild docs and figure out how to make that experience better, for users who are not able to leverage prebuild

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
electron-rebuild Issues related to how keytar is compiled in a project that also uses electron-rebuild
Projects
None yet
Development

No branches or pull requests