Grpc-node: MacOS 10.13.4 Can't install grpc

Created on 25 Apr 2018  路  12Comments  路  Source: grpc/grpc-node

Can't install grpc on MacOS 10.13.4
I run but getting following error
npm config set python /usr/bin/python2.7 npm install grpc --python=python2.7

CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/message_size/message_size_filter.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/workarounds/workaround_utils.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/plugin_registry/grpc_plugin_registry.o
  LIBTOOL-STATIC Release/libgrpc.a
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/nuruddin/.nvm/versions/node/v10.0.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:225:12)
gyp ERR! System Darwin 17.5.0
gyp ERR! command "/Users/nuruddin/.nvm/versions/node/v10.0.0/bin/node" "/Users/nuruddin/.nvm/versions/node/v10.0.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/Users/nuruddin/Desktop/io-website/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/Users/nuruddin/Desktop/io-website/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown"
gyp ERR! cwd /Users/nuruddin/Desktop/io-website/node_modules/grpc
gyp ERR! node -v v10.0.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/Users/nuruddin/.nvm/versions/node/v10.0.0/bin/node /Users/nuruddin/.nvm/versions/node/v10.0.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/Users/nuruddin/Desktop/io-website/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/Users/nuruddin/Desktop/io-website/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/nuruddin/Desktop/io-website/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:947:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:236:5)
node-pre-gyp ERR! System Darwin 17.5.0
node-pre-gyp ERR! command "/Users/nuruddin/.nvm/versions/node/v10.0.0/bin/node" "/Users/nuruddin/Desktop/io-website/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /Users/nuruddin/Desktop/io-website/node_modules/grpc
node-pre-gyp ERR! node -v v10.0.0
node-pre-gyp ERR! node-pre-gyp -v v0.7.0
node-pre-gyp ERR! not ok
Failed to execute '/Users/nuruddin/.nvm/versions/node/v10.0.0/bin/node /Users/nuruddin/.nvm/versions/node/v10.0.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/Users/nuruddin/Desktop/io-website/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/Users/nuruddin/Desktop/io-website/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown' (1)
npm WARN [email protected] requires a peer of ajv@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of eslint@~3.4.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of eslint@~3.4.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of [email protected] - 3.x but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of eslint@^2.0.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build --library=static_library`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
requires reporter action

Most helpful comment

@nicolasnoble node -v is v8.11.1 though?

Edit: fixed issue by downgrading project node to v9.9.0.

All 12 comments

Not the first time I see this problem specifically, but the better question is why isn't node-pre-gyp downloading the precompiled binary instead ? Could you share your whole log ?

I'm having a similar problem - Mac 10.13.4

Here are my logs...

sudo npm install -g grpc

[email protected] install /usr/local/lib/node_modules/grpc
node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp ERR! Pre-built binaries not installable for [email protected] and [email protected] (node-v48 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Hit error EACCES: permission denied, mkdir '/usr/local/lib/node_modules/grpc/src/node'
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/grpc/build'
gyp ERR! stack at Error (native)
gyp ERR! System Darwin 17.5.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--library=static_library" "--module=/usr/local/lib/node_modules/grpc/src/node/extension_binary/node-v48-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/usr/local/lib/node_modules/grpc/src/node/extension_binary/node-v48-darwin-x64-unknown"
gyp ERR! cwd /usr/local/lib/node_modules/grpc
gyp ERR! node -v v6.11.5
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --library=static_library --module=/usr/local/lib/node_modules/grpc/src/node/extension_binary/node-v48-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/usr/local/lib/node_modules/grpc/src/node/extension_binary/node-v48-darwin-x64-unknown' (1)
node-pre-gyp ERR! stack at ChildProcess. (/usr/local/lib/node_modules/grpc/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:920:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:230:5)
node-pre-gyp ERR! System Darwin 17.5.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/grpc
node-pre-gyp ERR! node -v v6.11.5
node-pre-gyp ERR! node-pre-gyp -v v0.7.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --library=static_library --module=/usr/local/lib/node_modules/grpc/src/node/extension_binary/node-v48-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/usr/local/lib/node_modules/grpc/src/node/extension_binary/node-v48-darwin-x64-unknown' (1)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build --library=static_library
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/Tony/.npm/_logs/2018-04-25T20_48_23_179Z-debug.log

@nicolasnoble here you go the full log:

2482 silly install [email protected]
2483 info lifecycle [email protected]~install: [email protected]
2484 silly install [email protected]
2485 info lifecycle [email protected]~install: [email protected]
2486 silly install [email protected]
2487 info lifecycle [email protected]~install: [email protected]
2488 verbose lifecycle [email protected]~install: unsafe-perm in lifecycle true
2489 verbose lifecycle [email protected]~install: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/nuruddin/Desktop/io-website/functions/node_modules/grpc/node_modules/.bin:/Users/nuruddin/Desktop/io-website/functions/node_modules/.bin:/Users/nuruddin/Desktop/io-website/node_modules/.bin:/Users/nuruddin/.config/yarn/link/node_modules/.bin:/Users/nuruddin/Desktop/io-website/node_modules/.bin:/Users/nuruddin/.config/yarn/link/node_modules/.bin:/usr/local/Cellar/node/10.0.0/libexec/lib/node_modules/npm/bin/node-gyp-bin:/usr/local/Cellar/node/10.0.0/lib/node_modules/npm/bin/node-gyp-bin:/usr/local/Cellar/node/10.0.0/bin/node_modules/npm/bin/node-gyp-bin:/usr/local/opt/python@2/libexec/bin:/usr/local/bin:/usr/local/sbin:/Users/nuruddin/.rbenv/shims:/usr/local/opt/python@2/libexec/bin:/usr/local/share/python:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/google/google-cloud-sdk/bin:/Users/nuruddin/go/bin:/usr/local/opt/go/libexec/bin
2490 verbose lifecycle [email protected]~install: CWD: /Users/nuruddin/Desktop/io-website/functions/node_modules/grpc
2491 silly lifecycle [email protected]~install: Args: [ '-c',
2491 silly lifecycle   'node-pre-gyp install --fallback-to-build --library=static_library' ]
2492 silly lifecycle [email protected]~install: Returned: code: 1  signal: null
2493 info lifecycle [email protected]~install: Failed to exec install script
2494 timing action:install Completed in 42663ms
2495 verbose unlock done using /Users/nuruddin/.npm/_locks/staging-aaca92d75b948ca6.lock for /Users/nuruddin/Desktop/io-website/functions/node_modules/.staging
2496 timing stage:rollbackFailedOptional Completed in 789ms
2497 timing stage:runTopLevelLifecycles Completed in 48152ms
2498 silly saveTree hoverboard-functions@

.... Here is a long tree and following goes below...

2499 verbose stack Error: [email protected] install: `node-pre-gyp install --fallback-to-build --library=static_library`
2499 verbose stack Exit status 1
2499 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:283:16)
2499 verbose stack     at EventEmitter.emit (events.js:182:13)
2499 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
2499 verbose stack     at ChildProcess.emit (events.js:182:13)
2499 verbose stack     at maybeClose (internal/child_process.js:947:16)
2499 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:236:5)
2500 verbose pkgid [email protected]
2501 verbose cwd /Users/nuruddin/Desktop/io-website/functions
2502 verbose Darwin 17.5.0
2503 verbose argv "/usr/local/Cellar/node/10.0.0/bin/node" "/usr/local/bin/npm" "i"
2504 verbose node v10.0.0
2505 verbose npm  v6.0.0
2506 error code ELIFECYCLE
2507 error errno 1
2508 error [email protected] install: `node-pre-gyp install --fallback-to-build --library=static_library`
2508 error Exit status 1
2509 error Failed at the [email protected] install script.
2509 error This is probably not a problem with npm. There is likely additional logging output above.
2510 verbose exit [ 1, true ]

Are you running the installation commands as root? If so, you may be able to fix this by running as a normal user or adding the --unsafe-perm flag to the command.

@3lll this is a different problem altogether, please don't conflate the two. Also, you are running npm as root yet still have permission errors when creating a directory ?

node-pre-gyp ERR! Hit error EACCES: permission denied, mkdir '/usr/local/lib/node_modules/grpc/src/node'

@Nuruddinjr you are still missing the crucial lines that should read something like:

node-pre-gyp ERR! Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.10.1/node-v64-linux-x64-glibc.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI, glibc) (falling back to source compile with node-gyp)

and that would tell us exactly what's going on.

I installed grpc after uninstalling nvm and reinstalling node and upgrade it.

@nicolasnoble I come up with this problem again.
here is how it goes with logs
sudo npm install --unsafe-perm=true

> [email protected] install /Users/nuruddin/projects/personal/react-wesbos/catch-of-the-day/node_modules/@firebase/firestore/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp ERR! Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.10.1/node-v64-darwin-x64-unknown.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI, unknown) (falling back to source compile with node-gyp)
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/avl/avl.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.o
...
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/max_age/max_age_filter.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/message_size/message_size_filter.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/workarounds/workaround_cronet_compression_filter.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/workarounds/workaround_utils.o
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/plugin_registry/grpc_plugin_registry.o
  LIBTOOL-STATIC Release/libgrpc.a
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 (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:235:12)
gyp ERR! System Darwin 17.5.0
gyp ERR! command "/usr/local/Cellar/node/10.1.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/Users/nuruddin/projects/personal/react-wesbos/catch-of-the-day/node_modules/@firebase/firestore/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown/grpc_node.node" "--module_name=grpc_node" "--module_path=/Users/nuruddin/projects/personal/react-wesbos/catch-of-the-day/node_modules/@firebase/firestore/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown"
gyp ERR! cwd /Users/nuruddin/projects/personal/react-wesbos/catch-of-the-day/node_modules/@firebase/firestore/node_modules/grpc
gyp ERR! node -v v10.1.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node/10.1.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/Users/nuruddin/projects/personal/react-wesbos/catch-of-the-day/node_modules/@firebase/firestore/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/Users/nuruddin/projects/personal/react-wesbos/catch-of-the-day/node_modules/@firebase/firestore/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/nuruddin/projects/personal/react-wesbos/catch-of-the-day/node_modules/@firebase/firestore/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:957:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:246:5)
node-pre-gyp ERR! System Darwin 17.5.0
node-pre-gyp ERR! command "/usr/local/Cellar/node/10.1.0/bin/node" "/Users/nuruddin/projects/personal/react-wesbos/catch-of-the-day/node_modules/@firebase/firestore/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /Users/nuruddin/projects/personal/react-wesbos/catch-of-the-day/node_modules/@firebase/firestore/node_modules/grpc
node-pre-gyp ERR! node -v v10.1.0
node-pre-gyp ERR! node-pre-gyp -v v0.7.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/Cellar/node/10.1.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/Users/nuruddin/projects/personal/react-wesbos/catch-of-the-day/node_modules/@firebase/firestore/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/Users/nuruddin/projects/personal/react-wesbos/catch-of-the-day/node_modules/@firebase/firestore/node_modules/grpc/src/node/extension_binary/node-v64-darwin-x64-unknown' (1)
npm WARN [email protected] requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build --library=static_library`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.


You're trying to install an older version of gRPC on node 10. We didn't have support for node 10 at the time.

@nicolasnoble node -v is v8.11.1 though?

Edit: fixed issue by downgrading project node to v9.9.0.

@nicolasnoble got it. thanks

@nicolasnoble @umarahmedov Thanks.

@nicolasnoble @umarahmedov Thank you.
Same issue to me as my node is 10.13. I am use nvm to switch the node version from 10.13 to 8.9.0. then run npm install. It fixed the issue. I found nvm is useful. You can install nvm with curl
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
Close terminal or run . ~/.bash_profile, then nvm install 8.9.0, then nvm use 8.9.0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

samuela picture samuela  路  4Comments

yanbou893 picture yanbou893  路  5Comments

wenxiwu777 picture wenxiwu777  路  4Comments

badoet picture badoet  路  4Comments

keyvhinng picture keyvhinng  路  5Comments