question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error while rebuilding native dependency grpc

See original GitHub issue
  • Version: 20.0.8
  • Target: Mac OS High Sierra 10.13.3 Electron version: 1.8.2

I am using electron with create-react-app and I am getting the following error:-

Error: /Users/nikhilagarwal/.nvm/versions/node/v6.9.0/bin/node exited with code 1
Error output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@0.6.39
node-pre-gyp info using node@6.9.0 | darwin | x64
node-pre-gyp http GET https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.9.1/electron-v1.8-darwin-x64-unknown.tar.gz
node-pre-gyp http 403 https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.9.1/electron-v1.8-darwin-x64-unknown.tar.gz
node-pre-gyp ERR! Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.9.1/electron-v1.8-darwin-x64-unknown.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for grpc@1.9.1 and electron@1.8.2 (electron-v1.8 ABI, unknown) (falling back to source compile with node-gyp) 
node-pre-gyp http 403 status code downloading tarball https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.9.1/electron-v1.8-darwin-x64-unknown.tar.gz 
gyp info it worked if it ends with ok
gyp info using node-gyp@3.4.0
gyp info using node@6.9.0 | darwin | x64
gyp info ok 
gyp info it worked if it ends with ok
gyp info using node-gyp@3.4.0
gyp info using node@6.9.0 | darwin | x64
gyp info spawn /usr/bin/python2.7
gyp info spawn args [ '/Users/nikhilagarwal/.nvm/versions/node/v6.9.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/nikhilagarwal/WitByBit/ledger/node_modules/grpc/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/nikhilagarwal/.nvm/versions/node/v6.9.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/nikhilagarwal/.node-gyp/iojs-1.8.2/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/nikhilagarwal/.node-gyp/iojs-1.8.2',
gyp info spawn args   '-Dnode_gyp_dir=/Users/nikhilagarwal/.nvm/versions/node/v6.9.0/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=iojs.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/nikhilagarwal/WitByBit/ledger/node_modules/grpc',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info ok 
gyp info it worked if it ends with ok
gyp info using node-gyp@3.4.0
gyp info using node@6.9.0 | darwin | x64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
Traceback (most recent call last):
  File "./gyp-mac-tool", line 611, in <module>
    sys.exit(main(sys.argv[1:]))
  File "./gyp-mac-tool", line 28, in main
    exit_code = executor.Dispatch(args)
  File "./gyp-mac-tool", line 43, in Dispatch
    return getattr(self, method)(*args[1:])
  File "./gyp-mac-tool", line 246, in ExecFilterLibtool
    if not libtool_re.match(line) and not libtool_re5.match(line):
TypeError: cannot use a string pattern on a bytes-like object
make: *** [Release/libgrpc.a] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/nikhilagarwal/.nvm/versions/node/v6.9.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Darwin 17.4.0
gyp ERR! command "/Users/nikhilagarwal/.nvm/versions/node/v6.9.0/bin/node" "/Users/nikhilagarwal/.nvm/versions/node/v6.9.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/Users/nikhilagarwal/WitByBit/ledger/node_modules/grpc/src/node/extension_binary/electron-v1.8-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/Users/nikhilagarwal/WitByBit/ledger/node_modules/grpc/src/node/extension_binary/electron-v1.8-darwin-x64-unknown"
gyp ERR! cwd /Users/nikhilagarwal/WitByBit/ledger/node_modules/grpc
gyp ERR! node -v v6.9.0
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/Users/nikhilagarwal/.nvm/versions/node/v6.9.0/bin/node /Users/nikhilagarwal/.nvm/versions/node/v6.9.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/Users/nikhilagarwal/WitByBit/ledger/node_modules/grpc/src/node/extension_binary/electron-v1.8-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/Users/nikhilagarwal/WitByBit/ledger/node_modules/grpc/src/node/extension_binary/electron-v1.8-darwin-x64-unknown' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/nikhilagarwal/WitByBit/ledger/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:877:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node-pre-gyp ERR! System Darwin 17.4.0
node-pre-gyp ERR! command "/Users/nikhilagarwal/.nvm/versions/node/v6.9.0/bin/node" "/Users/nikhilagarwal/WitByBit/ledger/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /Users/nikhilagarwal/WitByBit/ledger/node_modules/grpc
node-pre-gyp ERR! node -v v6.9.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok 
error Command failed with exit code 1.

    at ChildProcess.childProcess.once.code (/Users/nikhilagarwal/WitByBit/ledger/node_modules/builder-util/src/util.ts:252:14)
    at ChildProcess.g (events.js:291:16)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:877:16)
    at Socket.<anonymous> (internal/child_process.js:334:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:498:12)
From previous event:
    at runCallback (timers.js:637:20)
    at tryOnImmediate (timers.js:610:5)
    at processImmediate [as _immediateCallback] (timers.js:582:5)
From previous event:
    at /Users/nikhilagarwal/WitByBit/ledger/node_modules/electron-builder-lib/src/util/yarn.ts:149:27
From previous event:
    at rebuild (/Users/nikhilagarwal/WitByBit/ledger/node_modules/electron-builder-lib/out/util/yarn.js:93:22)
    at /Users/nikhilagarwal/WitByBit/ledger/node_modules/electron-builder-lib/src/util/yarn.ts:20:11
    at next (native)
    at runCallback (timers.js:637:20)
    at tryOnImmediate (timers.js:610:5)
    at processImmediate [as _immediateCallback] (timers.js:582:5)
From previous event:
    at installOrRebuild (/Users/nikhilagarwal/WitByBit/ledger/node_modules/electron-builder-lib/out/util/yarn.js:31:21)
    at /Users/nikhilagarwal/WitByBit/ledger/node_modules/electron-builder-lib/src/packager.ts:450:7
    at next (native)
From previous event:
    at Packager.installAppDependencies (/Users/nikhilagarwal/WitByBit/ledger/node_modules/electron-builder-lib/out/packager.js:505:11)
    at /Users/nikhilagarwal/WitByBit/ledger/node_modules/electron-builder-lib/src/packager.ts:364:20
    at next (native)
From previous event:
    at Packager.doBuild (/Users/nikhilagarwal/WitByBit/ledger/node_modules/electron-builder-lib/out/packager.js:441:11)
    at /Users/nikhilagarwal/WitByBit/ledger/node_modules/electron-builder-lib/src/packager.ts:316:52
    at next (native)
    at /Users/nikhilagarwal/WitByBit/ledger/node_modules/graceful-fs/graceful-fs.js:99:16
    at /Users/nikhilagarwal/WitByBit/ledger/node_modules/graceful-fs/graceful-fs.js:43:10
    at FSReqWrap.oncomplete (fs.js:123:15)
From previous event:
    at Packager._build (/Users/nikhilagarwal/WitByBit/ledger/node_modules/electron-builder-lib/out/packager.js:385:11)
    at /Users/nikhilagarwal/WitByBit/ledger/node_modules/electron-builder-lib/src/packager.ts:278:23
    at next (native)
    at runCallback (timers.js:637:20)
    at tryOnImmediate (timers.js:610:5)
    at processImmediate [as _immediateCallback] (timers.js:582:5)
From previous event:
    at Packager.build (/Users/nikhilagarwal/WitByBit/ledger/node_modules/electron-builder-lib/out/packager.js:341:11)
    at /Users/nikhilagarwal/WitByBit/ledger/node_modules/electron-builder-lib/src/index.ts:50:40
    at next (native)
From previous event:
    at build (/Users/nikhilagarwal/WitByBit/ledger/node_modules/electron-builder-lib/out/index.js:47:21)
    at build (/Users/nikhilagarwal/WitByBit/ledger/node_modules/electron-builder/src/builder.ts:228:10)
    at then (/Users/nikhilagarwal/WitByBit/ledger/node_modules/electron-builder/src/cli/cli.ts:48:33)
    at runCallback (timers.js:637:20)
    at tryOnImmediate (timers.js:610:5)
    at processImmediate [as _immediateCallback] (timers.js:582:5)
From previous event:
    at Object.args [as handler] (/Users/nikhilagarwal/WitByBit/ledger/node_modules/electron-builder/src/cli/cli.ts:48:33)
    at Object.runCommand (/Users/nikhilagarwal/WitByBit/ledger/node_modules/electron-builder/node_modules/yargs/lib/command.js:235:44)
    at Object.parseArgs [as _parseArgs] (/Users/nikhilagarwal/WitByBit/ledger/node_modules/electron-builder/node_modules/yargs/yargs.js:1042:24)
    at Object.get [as argv] (/Users/nikhilagarwal/WitByBit/ledger/node_modules/electron-builder/node_modules/yargs/yargs.js:957:21)
    at Object.<anonymous> (/Users/nikhilagarwal/WitByBit/ledger/node_modules/electron-builder/src/cli/cli.ts:42:15)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3
error Command failed with exit code 1.

Here’s my package.json:-

{
  "name": "app",
  "version": "0.1.0",
  "main": "public/electron.js",
  "description": "app",
  "homepage": "./",
  "private": true,
  "build": {
    "extends": null,
    "asar": false,
    "productName": "xxx",
    "appId": "com.xxx.xxx",
    "files": [
      {
        "from": ".",
        "to": ".",
        "filter": [
          "electron",
          "images",
          "node_modules",
          "electron.js",
          "package.json"
        ]
      },
      {
        "from": "./xxx/build",
        "to": ".",
        "filter": [
          "**/*"
        ]
      }
    ],
    "mac": {
      "artifactName": "${productName}-${version}-osx.${ext}",
      "category": "public.app-category.productivity",
      "target": [
        "dmg",
        "zip"
      ]
    },
    "linux": {
      "artifactName": "${productName}-${version}-${arch}-linux.${ext}",
      "maintainer": "xxxx",
      "target": [
        "tar.gz",
        "deb",
        "rpm"
      ]
    },
    "win": {
      "target": [
        "zip",
        "dir"
      ]
    }
  },
  "dependencies": {
  ...
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --env=jsdom",
    "eject": "react-scripts eject",
    "electron-dev": "concurrently \"cross-env BROWSER=none yarn start\" \"wait-on http://localhost:3000 && electron .\"",
    "electron-pack": "build"
  },
  "devDependencies": {
    "concurrently": "^3.5.1",
    "cross-env": "^5.1.3",
    "electron": "1.8.2",
    "electron-builder": "^20.0.8",
    "wait-on": "^2.1.0"
  }
}

Kindly help me out with this issue. I have already spent multiple hours on this issue and tried with several different versions of node js. All fail with the error above.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:10

github_iconTop GitHub Comments

3reactions
AlekzZzcommented, May 5, 2018

btw, electron-builder 19.54.0 works perfectly fine with any electron version, but later versions don’t ¯\_(ツ)_/¯

1reaction
mike-seekwellcommented, May 14, 2019

@nikhilag @csepulv I know this is way late, but for anyone else running into this issue, I’m pretty sure it’s caused by using Python 3 instead of Python 2, see https://github.com/nodejs/node-gyp

node-gyp --python /path/to/python2.7
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to solve electron and grpc version problem in angular ...
Error states that you need windows-build-tools . Error logs directs you to node-gyp repository, from where you can find directives on how to ......
Read more >
Quick start | C++ - gRPC
This guide gets you started with gRPC in C++ with a simple working example. Contents. Build and locally install gRPC and Protocol Buffers....
Read more >
Npm install command failing with message "could not find ...
When I run the npm install command, npm starts downloading the dependencies. But then, suddenly, it stops with the error:
Read more >
Compile fault when doing $ npm run rebuild - Bugs & issues - Meta ...
In the upcoming version I'm working on right now that gRPC native dependency is removed, we're now using a direct gRPC on the...
Read more >
Protocol Buffers/gRPC Codegen Integration Into .NET Build
You must add a reference to the NuGet packages Grpc.Tools and Grpc (the latter is a meta-package, in turn referencing Grpc.Core and Google.Protobuf...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found