I`m making an Electron app that should connect by grpc to remote host and call some functions from there.
But I keep getting the following error: Uncaught Error: A dynamic link library (DLL) initialization routine failed. \?\D:\Projects\demo-app\node_modules\grpc\src\node\extension_binary\grpc_node.node
I tried to:
- establish grpc connection from main and from renderer processes of Electron
install dependencies as
npm install --unsafe-perm
but nothing works.
Error
I`m making an Electron app that should connect by grpc to remote host and call some functions from there.
But I keep getting the following error: Uncaught Error: A dynamic link library (DLL) initialization routine failed. \?\D:\Projects\demo-app\node_modules\grpc\src\node\extension_binary\grpc_node.node
I tried to:
- establish grpc connection from main and from renderer processes of Electron
install dependencies as
npm install --unsafe-perm
but nothing works.
Error
Share Improve this question asked Jul 9, 2017 at 16:09 juldepoljuldepol 1431 gold badge3 silver badges9 bronze badges2 Answers
Reset to default 11The gRPC package is distributed with prepiled binaries for Electron, including on Windows, but you have to specify that you're using Electron when you do the installation. The following should work:
npm install grpc --runtime=electron --target=<electron version>
If you're using a native module, you'll need to rebuild them against your current electron node version.
There is a package called electron-rebuild that will do this for you. Basic instructions:
npm install --save-dev electron-rebuild
Then, whenever you install a new npm package, rerun electron-rebuild:
./node_modules/.bin/electron-rebuild
Or if you're on Windows:
.\node_modules\.bin\electron-rebuild.cmd