Seems like because it is called through electron and not through node.js it
tries to look in the wrong folder for the extension binary!

Expected directory: electron-v1.8-linux-x64-glibc
Found: [node-v57-linux-x64-glibc]
This problem can often be fixed by running "npm rebuild" on the current
system
Original error: Cannot find module
'/home/stefan/Work/ElectroNGL/node_modules/grpc/src/node/extension_binary/electron-v1.8-linux-x64-glibc/grpc_node.node'

But this folder doesn't exist. Would I be able to force it to look for it
in node-v57-linux-x64-glibc?

On Fri, Apr 20, 2018 at 9:41 AM, Stefan Doerr <[email protected]> wrote:

> Same problem actually if I move the require('grpc') inside of main.js
>
> ```
> main.js
>
> 'use strict';
> var grpc = require('grpc');
> const electron = require('electron');
> ```
>
> Throws the same error
>
> On Fri, Apr 20, 2018 at 9:34 AM, Stefan Doerr <[email protected]> wrote:
>
>> Sure. I tried using it through Electron. So I just start the main.js with
>> electron and get the error in the js console.
>>
>> ```
>> main.js
>>
>> 'use strict';
>>
>> const electron = require('electron');
>> const app = electron.app;
>> const BrowserWindow = electron.BrowserWindow;
>>
>> require('electron-debug')({showDevTools: true});
>>
>> var mainWindow = null;
>>
>> app.on('ready', function() {
>>     mainWindow = new BrowserWindow({
>>         height: 600,
>>         width: 800,
>>     });
>>
>>     mainWindow.loadURL('file://' + __dirname + '/app/webapp.html');
>>     mainWindow.setMenu(null);
>> });
>> ```
>>
>> ```
>> webapp.html
>>
>> <!DOCTYPE html>
>> <html lang="en">
>> <head>
>>   <title>webapp</title>
>>   <meta charset="utf-8">
>>   <meta name="viewport" content="width=device-width, user-scalable=no,
>> minimum-scale=1.0, maximum-scale=1.0">
>>   <link rel="stylesheet" href="css/font-awesome.min.css" />
>>   <link rel="stylesheet" href="css/main.css" />
>>   <link rel="subresource" href="css/light.css" />
>>   <link rel="subresource" href="css/dark.css" />
>> </head>
>> <body>
>> <!-- Insert this line above script imports  -->
>> <script>if (typeof module === 'object') {window.module = module; module =
>> undefined;}</script>
>>
>> <!-- normal script imports etc  -->
>>   <!-- NGL -->
>>   <script src="dist/ngl.js"></script>
>>
>>   <!-- UI -->
>>   <script src="js/lib/signals.min.js"></script>
>>   <script src="js/lib/tether.min.js"></script>
>>   <script src="js/lib/colorpicker.min.js"></script>
>>   <script src="js/ui/ui.js"></script>
>>   <script src="js/ui/ui.extra.js"></script>
>>   <script src="js/ui/ui.ngl.js"></script>
>>   <script src="js/gui.js"></script>
>>
>> <!-- Insert this line after script imports -->
>> <script>if (window.module) module = window.module;</script>
>> </body>
>> <script>
>>
>>     //var PROTO_PATH = __dirname + '/../communication.proto';
>>     var PROTO_PATH = '../communication.proto';
>>     var grpc = require('grpc');
>>     var hello_proto = grpc.load(PROTO_PATH).helloworld;
>>
>>     /**
>>      * Implements the SayHello RPC method.
>>      */
>>     function sayHello(call, callback) {
>>       callback(null, {message: 'Hello ' + call.request.name});
>>     }
>>
>>     /**
>>      * Starts an RPC server that receives requests for the Greeter
>> service at the
>>      * sample server port
>>      */
>>     function main() {
>>       var server = new grpc.Server();
>>       server.addService(hello_proto.Greeter.service, {sayHello:
>> sayHello});
>>       server.bind('0.0.0.0:50051', grpc.ServerCredentials.createI
>> nsecure());
>>       server.start();
>>     }
>>
>>     main();
>>     console.log('Started server?')
>> </script>
>> </html>
>> ```
>>
>> On Fri, Apr 20, 2018 at 12:40 AM, Spencer Fang <[email protected]>
>> wrote:
>>
>>> Can you share the commands you ran that led to this error?
>>>
>>> On Thu, Apr 19, 2018 at 1:41 PM <[email protected]> wrote:
>>>
>>>> I am trying to use gRPC for the first time but I am getting following
>>>> error:
>>>>
>>>> Uncaught Error: Failed to load gRPC binary module because it was not
>>>> installed for the current system
>>>> Expected directory: electron-v1.8-linux-x64-glibc
>>>> Found: [node-v57-linux-x64-glibc]
>>>> This problem can often be fixed by running "npm rebuild" on the current
>>>> system
>>>> Original error: Cannot find module '/home/stefan/Work/myproj/node
>>>> _modules/grpc/src/node/extension_binary/electron-v1.8-linux-
>>>> x64-glibc/grpc_node.node'
>>>>     at Object.<anonymous> (/home/stefan/Work/myproj/node
>>>> _modules/grpc/src/grpc_extension.js:53:17)
>>>>     at Object.<anonymous> (/home/stefan/Work/myproj/node
>>>> _modules/grpc/src/grpc_extension.js:63:3)
>>>>     at Module._compile (module.js:569:30)
>>>>     at Object.Module._extensions..js (module.js:580:10)
>>>>     at Module.load (module.js:503:32)
>>>>     at tryModuleLoad (module.js:466:12)
>>>>     at Function.Module._load (module.js:458:3)
>>>>     at Module.require (module.js:513:17)
>>>>     at require (internal/module.js:11:18)
>>>>     at Object.<anonymous> (/home/stefan/Work/ElectroNGL/
>>>> node_modules/grpc/src/client.js:37:12)
>>>>
>>>>
>>>> I checked and my node.js version should be supported
>>>> $ node --version
>>>> v8.9.3
>>>>
>>>>
>>>> Could you help me out with this?
>>>>
>>>> Thanks!
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "grpc.io" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> To post to this group, send email to [email protected].
>>>> Visit this group at https://groups.google.com/group/grpc-io.
>>>> To view this discussion on the web visit https://groups.google.com/d/ms
>>>> gid/grpc-io/9fa9c6cc-0d1d-49ee-b81e-b3d7a0bbed58%40googlegroups.com
>>>> <https://groups.google.com/d/msgid/grpc-io/9fa9c6cc-0d1d-49ee-b81e-b3d7a0bbed58%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>>
>>> --
>>> Spencer Fang
>>>
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CAKLxUuFgDBmMmUSVS_x3usdMAnezkxgOFUHwOvjtM0qB3Re9PQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to