Sharp: Electron: DLL initialization failed

Created on 21 Jan 2018  路  3Comments  路  Source: lovell/sharp

After installing sharp, got the following when I'm trying to run my Electron app:

electron .

App threw an error during load Error: A dynamic link library (DLL) initialization routine failed. \\?\C:\eprojects\powcast\node_modules\sharp\build\Release\sharp.node 
at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20) 
at Object.Module._extensions..node (module.js:598:18) 
at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20) 
at Module.load (module.js:488:32) 
at tryModuleLoad (module.js:447:12) 
at Function.Module._load (module.js:439:3) 
at Module.require (module.js:498:17) 
at require (internal/module.js:20:19) 
at Object.<anonymous> (C:\eprojects\powcast\node_modules\sharp\lib\constructor.js:10:15) 
at Object.<anonymous> (C:\eprojects\powcast\node_modules\sharp\lib\constructor.js:253:3)

Output of npm install --verbose sharp - https://pastebin.com/yhMqDAxG

Thanks for your help!

question

Most helpful comment

Lovell, huge thanks for looking into this. According to Task Manager, both electron.exe and node.exe are x64.

Dependency walker point out a ton of API-MS-WIN-... missing - https://paste.ubuntu.com/26432975/

I didn't see/use https://github.com/electron/electron-rebuild but now that I tried it, it seems to either not affect the problem or change it to App threw an error during load \ Error: The module '\\?\C:\eprojects\powcast\node_modules\sharp\build\Release\sharp.node' \ was compiled against a different Node.js version using \ NODE_MODULE_VERSION 50. This version of Node.js requires NODE_MODULE_VERSION 54. Please try re-compiling or re-installing \ the module (for instance, usingnpm rebuildornpm install).

It looks like these troubles are not necessarily related to sharp and might be about my broken setup for any native nodejs binary - in this case, feel free to close this. Thanks!

All 3 comments

Are you using the x64 version of Electron?
Does Dependency Walker reports any errors about node_modules\sharp\build\Release\sharp.node?

Lovell, huge thanks for looking into this. According to Task Manager, both electron.exe and node.exe are x64.

Dependency walker point out a ton of API-MS-WIN-... missing - https://paste.ubuntu.com/26432975/

I didn't see/use https://github.com/electron/electron-rebuild but now that I tried it, it seems to either not affect the problem or change it to App threw an error during load \ Error: The module '\\?\C:\eprojects\powcast\node_modules\sharp\build\Release\sharp.node' \ was compiled against a different Node.js version using \ NODE_MODULE_VERSION 50. This version of Node.js requires NODE_MODULE_VERSION 54. Please try re-compiling or re-installing \ the module (for instance, usingnpm rebuildornpm install).

It looks like these troubles are not necessarily related to sharp and might be about my broken setup for any native nodejs binary - in this case, feel free to close this. Thanks!

Was this page helpful?
0 / 5 - 0 ratings