nodejs / help

:sparkles: Need help with Node.js? File an Issue here. :rocket:
1.48k stars 284 forks source link

DLL initialization routine failed #1708

Closed DragonOsman closed 5 years ago

DragonOsman commented 5 years ago

I can't tell how to build Zlib without also creating zlib.dll. And when building Node.js I have to link against that DLL when building the project file node.vcxproj. But it won't do that when I don't also specify the dll argument when running vcbuild. That gave me both node.lib and node.dll when I built Node.js.

I was able to successfully build an addon with that using node-gyp, but when I tried to run the Node.js app using the addon, I got an error message that, among other things, also said that a DLL initialization routine had failed. So my guess is that it couldn't initialize node.dll. Is there a way to fix this? Thanks in advance.

Note: I uninstalled that home-built one and downloaded the MSI installer from the Nodejs website so I could use that to build and run the addon. I'll have to build Node.js again. Before, I forgot to put node.dll inside the directory that seemed like it would be copied into my Nodejs installation directory when I run the MSI installer I'd built (yes, I had to build the MSI installer as well so that Node would be installed in the directory I'd specified for the --prefix setting). I put node.dll in the installation directory after trying to run node.exe and seeing an error message saying that it can't find node.dll (the installation directory I had the MSI installer put it in was the default one, C:/Program Files/nodejs, and the directory I built Node.js in was the Node.js source tree directory, in the top level of the C:/ directory). This time I should probably try to get node.dll copied into the installation directory with the rest of the stuff.

DragonOsman commented 5 years ago

I built it again and this time I installed Nodejs directly in C:\ instead of C:\Program Files because I read on an issue thread in the GitHub page for Eletronjs that putting it in C:\Program Files creates a problem with permissions and messes stuff up. But I still get that DLL initialization routine failure error when I try to run my Node.js application that uses the addon I built.

This is what happens:

node parseurl_use.js
internal/modules/cjs/loader.js:750
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: A dynamic link library (DLL) initialization routine failed.
\\?\E:\programming\Node_Addons\urlparser_addon\build\Release\urlparser.node
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:750:18)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
    at Function.Module._load (internal/modules/cjs/loader.js:552:3)
    at Module.require (internal/modules/cjs/loader.js:657:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (E:\programming\Node_Addons\urlparser_addon\parseurl_use.js:1:80)
    at Module._compile (internal/modules/cjs/loader.js:721:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)

I enter the command to node to run the application, and I get the above error. The problem doesn't seem to have to do with needing to rebuild the addon if anything changes because I also tried to run the app again after rebuilding the addon. The main part to look at is: Error: A dynamic link library (DLL) initialization routine failed..

Any help would be appreciated. Thanks in advance.

gireeshpunathil commented 5 years ago

@DragonOsman - can you share your addon code?

gireeshpunathil commented 5 years ago

inactive, closing