Closed
Description
- Node Version: 8.9.4
- Platform: Windows
- Compiler: MSVC 15
I was led to believe that the new n-api was not only going to be compatible across all node runtimes, but also going to be compatible when building a native module for node vs building for electron.
If you build the basic hello-world example for n-api found here, the addon.node
file cannot be required when running from the electron runtime. I get the following error:
A dynamic link library (DLL) initialization routine failed.
\\?\C:\Users\kelannen\source\napi-test\build\Release\addon.node
Error: A dynamic link library (DLL) initialization routine failed.
\\?\C:\Users\kelannen\source\napi-test\build\Release\addon.node
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:172:20)
at Object.Module._extensions..node (module.js:671:18)
at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:172:20)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:504:12)
at Function.Module._load (module.js:496:3)
at Module.require (module.js:586:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Users\kelannen\source\napi-test\test.js:2:15)
at Object.<anonymous> (C:\Users\kelannen\source\napi-test\test.js:6:3)
at Module._compile (module.js:642:30)
at Object.Module._extensions..js (module.js:653:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:504:12)
at Function.Module._load (module.js:496:3)
at Module.require (module.js:586:17)
at require (internal/module.js:11:18)
at C:\Users\kelannen\source\napi-test\node_modules\mocha\lib\mocha.js:253:27
at Array.forEach (<anonymous>)
at Mocha.loadFiles (C:\Users\kelannen\source\napi-test\node_modules\mocha\lib\mocha.js:250:14)
at Mocha.run (C:\Users\kelannen\source\napi-test\node_modules\mocha\lib\mocha.js:577:10)
at Object.run (C:\Users\kelannen\source\napi-test\node_modules\electron-mocha\mocha.js:54:30)
at App.app.on (C:\Users\kelannen\source\napi-test\node_modules\electron-mocha\index.js:54:13)
at emitTwo (events.js:131:20)
at App.emit (events.js:214:7)
I set up a basic test here:
https://github.com/jpkolbush/napi-test
Steps to reproduce:
npm install
#runs node-gyp configure-build
npm run build
#confirms that the module can be included with node runtime
node test.js
#requires the node module while running electron-mocha, this command will fail
npm run electron-test
This is only an issue on Windows, does not appear on Unix.
Metadata
Metadata
Assignees
Labels
No labels