{"action":"created","issue":{"url":"https://api.github.com/repos/grpc/grpc-node/issues/565","repository_url":"https://api.github.com/repos/grpc/grpc-node","labels_url":"https://api.github.com/repos/grpc/grpc-node/issues/565/labels{/name}","comments_url":"https://api.github.com/repos/grpc/grpc-node/issues/565/comments","events_url":"https://api.github.com/repos/grpc/grpc-node/issues/565/events","html_url":"https://github.com/grpc/grpc-node/issues/565","id":365506817,"node_id":"MDU6SXNzdWUzNjU1MDY4MTc=","number":565,"title":"Version mismatch error when loading gRPC in Electron","user":{"login":"nikolovp","id":5859395,"node_id":"MDQ6VXNlcjU4NTkzOTU=","avatar_url":"https://avatars0.githubusercontent.com/u/5859395?v=4","gravatar_id":"","url":"https://api.github.com/users/nikolovp","html_url":"https://github.com/nikolovp","followers_url":"https://api.github.com/users/nikolovp/followers","following_url":"https://api.github.com/users/nikolovp/following{/other_user}","gists_url":"https://api.github.com/users/nikolovp/gists{/gist_id}","starred_url":"https://api.github.com/users/nikolovp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nikolovp/subscriptions","organizations_url":"https://api.github.com/users/nikolovp/orgs","repos_url":"https://api.github.com/users/nikolovp/repos","events_url":"https://api.github.com/users/nikolovp/events{/privacy}","received_events_url":"https://api.github.com/users/nikolovp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-10-01T15:07:31Z","updated_at":"2018-10-01T16:53:01Z","closed_at":null,"author_association":"NONE","body":"### Problem description\r\nI am new to gRPC and I am trying to load the node binding in an Electron process but all I get is this error:\r\n\r\n```\r\nError: Failed to load gRPC binary module because it was not installed for the current system\r\nExpected directory: node-v64-win32-x64-unknown\r\nFound: [electron-v3.0-win32-x64-unknown]\r\nThis problem can often be fixed by running \"npm rebuild\" on the current system\r\nOriginal error: Cannot find module '<app>\\node_modules\\grpc\\src\\node\\extension_binary\\node-v64-win32-x64-unknown\\grpc_node.node'\r\n    at Object.<anonymous> (<app>\\node_modules\\grpc\\src\\grpc_extension.js:53:17)\r\n    at Object.<anonymous> (<app>\\node_modules\\grpc\\src\\grpc_extension.js:63:3)\r\n    at Module._compile (internal/modules/cjs/loader.js:711:30)\r\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:722:10)\r\n    at Module.load (internal/modules/cjs/loader.js:620:32)\r\n    at tryModuleLoad (internal/modules/cjs/loader.js:559:12)\r\n    at Function.Module._load (internal/modules/cjs/loader.js:551:3)\r\n    at Module.require (internal/modules/cjs/loader.js:658:17)\r\n    at require (internal/modules/cjs/helpers.js:20:18)\r\n    at Object.<anonymous> (<app>\\node_modules\\grpc\\src\\client_interceptors.js:145:12)\r\n```\r\n\r\n### Environment\r\n - Windows 10 - x64\r\n - Node v8.12.0 - regular installation from .msi\r\n - npm v6.4.1\r\n - yarn v1.7.0\r\n - Electron v3.0.2\r\n - gRPC@1.15.1\r\n\r\n### Additional context\r\nAs the additional information hints, I am trying to run gRPC v1.15.1 in Electron v.3.0.2.\r\n\r\nInstead of rebuilding all native module after installation I am using build target configuration in a .npmrc file:\r\n```\r\nruntime=electron\r\ntarget=3.0.2\r\ntarget_arch=x64\r\ndisturl=https://atom.io/download/electron\r\n```\r\nI am usually using `yarn` instead of `npm` but in that case I tried with both and the result was the same.\r\nI am not passing any arguments since all I need is already defined in the .npmrc file.\r\n\r\nI also tried to run `npm rebuild grpc` but I get the same error when I load the binding. The output from `npm rebuild` is:\r\n```\r\n> grpc@1.14.2 install<app>\\node_modules\\grpc\r\n> node-pre-gyp install --fallback-to-build --library=static_library\r\n\r\nnode-pre-gyp WARN Using request for node-pre-gyp https download\r\n[grpc] Success: \"<app>\\node_modules\\grpc\\src\\node\\extension_binary\\electron-v3.0-win32-x64-unknown\\grpc_node.node\" already installed\r\nPass --update-binary to reinstall or --build-from-source to recompile\r\ngrpc@1.14.2 <app>\\node_modules\\grpc\r\n```\r\n\r\nI get exactly the same output and error if I manually pass all runtime & target arguments to `npm rebuild.\r\n`npm rebuild gprc --runtime=electron --target=3.0.2 --target_arch=x64 --dist-url=https://atom.io/download/electron`\r\n\r\nThe content of `grpc\\src\\node\\extension_binary\\` is:\r\n - electron-v3.0-win32-x64-unknown\r\n   - grpc_node.node\r\n\r\nThe .npmrc configuration should be fine since I am also using few other native modules (some them with pre-built binaries) and they all download/build without errors.\r\n\r\nI didn't try to build from source because the initial README says this is quite complex task."},"comment":{"url":"https://api.github.com/repos/grpc/grpc-node/issues/comments/425980915","html_url":"https://github.com/grpc/grpc-node/issues/565#issuecomment-425980915","issue_url":"https://api.github.com/repos/grpc/grpc-node/issues/565","id":425980915,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNTk4MDkxNQ==","user":{"login":"murgatroid99","id":961599,"node_id":"MDQ6VXNlcjk2MTU5OQ==","avatar_url":"https://avatars3.githubusercontent.com/u/961599?v=4","gravatar_id":"","url":"https://api.github.com/users/murgatroid99","html_url":"https://github.com/murgatroid99","followers_url":"https://api.github.com/users/murgatroid99/followers","following_url":"https://api.github.com/users/murgatroid99/following{/other_user}","gists_url":"https://api.github.com/users/murgatroid99/gists{/gist_id}","starred_url":"https://api.github.com/users/murgatroid99/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/murgatroid99/subscriptions","organizations_url":"https://api.github.com/users/murgatroid99/orgs","repos_url":"https://api.github.com/users/murgatroid99/repos","events_url":"https://api.github.com/users/murgatroid99/events{/privacy}","received_events_url":"https://api.github.com/users/murgatroid99/received_events","type":"User","site_admin":false},"created_at":"2018-10-01T16:53:01Z","updated_at":"2018-10-01T16:53:01Z","author_association":"MEMBER","body":"Module version 64 is actually Node 10, which interestingly is the version of Node included in Electron 3, not the version of Node installed on their system. I think there is a possibility here that node-pre-gyp is loading modules differently on Electron 3."}}
{"actor":{"display_login":"murgatroid99"}}