lmdb-js
lmdb-js copied to clipboard
Error: A dynamic link library (DLL) initialization routine failed
Hi,
I want to use pkg to create a windows binary of my app including lmdb.
I'm a little bit lost and don't know how to fix the error. Is this a config thing ? windows ? node ? pkg ? lmdb ? Node 14.19.1 is installed and used by pkg. I built the native node files using the commands in lmdb package.json.
pkg/prelude/bootstrap.js:1833
throw error;
^
Error: A dynamic link library (DLL) initialization routine failed
C:\Users\xxxxxx\AppData\Local\Temp\pkg\ffc9b19bc2f52a93e9316025fa171e0b702d12bbd5781ad7c04c1dff7f471ea9\lmdb-win32-x64\node.abi83.node
at process.dlopen (pkg/prelude/bootstrap.js:2212:28)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1144:18)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at Module.require (pkg/prelude/bootstrap.js:1812:31)
at require (internal/modules/cjs/helpers.js:101:18)
at load (C:\snapshot\lmdbpkgtest\node_modules\node-gyp-build-optional-packages\index.js:21:10)
at Object.<anonymous> (C:\snapshot\lmdbpkgtest\node_modules\lmdb\dist\index.cjs:47:64)
at Module._compile (pkg/prelude/bootstrap.js:1887:22) {
code: 'ERR_DLOPEN_FAILED'
}
index.js
const lmdb = require('lmdb')
package.json (with pkg config)
{
"name": "lmdbpkgtest",
"version": "1.0.0",
"description": "",
"main": "src/index.js",
"bin": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"pkg": {
"targets": [
"node14-win-x64"
],
"outputPath": "dist/",
"assets": [
"node_modules/lmdb-win32-x64/*"
]
},
"author": "",
"license": "ISC",
"dependencies": {
"lmdb": "^2.3.10"
}
}
I tried this out locally and getting the same error. And I have tried this with a stripped-down barebones native .node module, still get this error or Module did not self-register error, so am wondering if pkg really works consistently with native modules.
Thanks for the test It's the first time for me that pkg does not work.
I have tried caxa now. My "Hello World" binary with lmdb runs error free on windows and linux.
That's good to hear that you had some success. I think I have heard of people using nexe too (I haven't tried it).
I'd still be interested in figuring out the issue with pkg (and/or letting them know).
As it turns out, the issue was due the win_delay_load_hook: false flag. This is a rather cryptic bit of node-gyp configuration that I had thought was helpful for electron. I removed this line for now, which seems to fix this issue. But I will see if I can try this out with electron to see if it causes any regressions.
Seems like electron loads fine with this flag removed.