最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Can`t make gRPC work with Electron.js - Stack Overflow

programmeradmin4浏览0评论

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:

  1. establish grpc connection from main and from renderer processes of Electron
  2. 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:

  1. establish grpc connection from main and from renderer processes of Electron
  2. 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 badges
Add a ment  | 

2 Answers 2

Reset to default 11

The 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
发布评论

评论列表(0)

  1. 暂无评论