在电子中使用gRPC

我试图要求在一个电子应用grpc,但我得到以下错误:

Error: dlopen(/srv/node_modules/grpc/src/node/extension_binary/grpc_node.node, 1): Symbol not found: _GENERAL_NAME_free Referenced from: /srv/node_modules/grpc/src/node/extension_binary/grpc_node.node Expected in: flat namespace 

我使用的是OSX Sierra 10.12.1,节点6.8.1,电子1.4.4和grpc 1.0.1-pre1。

我升级了xcode命令行工具,并且安装了openssl –force。

我build立了二进制文件:

 LDFLAGS=-L/usr/local/opt/openssl/lib CPPFLAGS=-I/usr/local/opt/openssl/include ./node_modules/.bin/electron-rebuild 

并手动使用:

 LDFLAGS=-L/usr/local/opt/openssl/lib CPPFLAGS=-I/usr/local/opt/openssl/include HOME=~/.electron-gyp node-pre-gyp rebuild --target=1.4.4 --arch=x64 --dist-url=https://atom.io/download/atom-shell 

但是当我运行应用程序,我仍然得到错误。

像这样重buildgrpc模块

 npm install --save-dev electron-rebuild (On Mac & Linux) ./node_modules/.bin/electron-rebuild (On Windows) .\node_modules\.bin\electron-rebuild.cmd 

这将重buildGRPC,你很好。