Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using gRPC in Electron

Tags:

I'm trying to require grpc in an electron app but I get the following error:

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

I'm using OSX Sierra 10.12.1, node 6.8.1, electron 1.4.4 and grpc 1.0.1-pre1.

I upgraded xcode command line tools and did a brew install openssl --force.

I built the binary with:

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

and manually with:

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

But when I run the app I still get the error.

like image 774
jabbermonkey Avatar asked Oct 26 '16 15:10

jabbermonkey


1 Answers

Rebuild the grpc module like so

npm install --save-dev electron-rebuild

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

This will rebuild GRPC and you're good to go.

like image 82
Sanket Berde Avatar answered Sep 24 '22 16:09

Sanket Berde