grpc-node icon indicating copy to clipboard operation
grpc-node copied to clipboard

gRPC sporadically doesn't build properly under node 11.

Open lafama opened this issue 8 years ago • 45 comments

Problem description

A clear and concise description of what the problem is. After upgrading to node 11.0.0 npm install fails due to @google-cloud/language dependency which has a dependency to google-gax which has a dependency to [email protected]

 node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp WARN Using request for node-pre-gyp https download 
node-pre-gyp WARN Tried to download(404): https://node-precompiled-binaries.grpc.io/grpc/v1.15.1/node-v67-darwin-x64-unknown.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v67 ABI, unknown) (falling back to source compile with node-gyp) 
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v67 ABI, unknown) (falling back to source compile with node-gyp) 
node-pre-gyp WARN Hit error Connection closed while downloading tarball file 

grpc/src/node/extension_binary/node-v67-darwin-x64-unknown --napi_version=3 --node_abi_napi=napi' (1)
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.oexec install script
../deps/grpc/src/core/lib/backoff/backoff.cc:19:10: fatal error: 'grpc/support/port_platform.h' file not found
#include <grpc/support/port_platform.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.░⸩ ⠸ install: info lifecycle [email protected]~install: Failed to exec install script
make: *** [Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.o] Error 1

Reproduction steps

Give very precise steps you've discovered to reproduce your problem. If possible and applicable, provide us with a repository we can clone that contains a reproduction case. Also if possible and applicable, please include a Dockerfile that exhibits the problem if it's specific to a certain environment. Bug reports with no reproduction steps will be closed. Npm install -Node version 11.0.0 -Add reference to @google-cloud/language

Environment

  • OS name, version and architecture: [e.g. Linux Ubuntu 18.04 amd64] Mac OS
  • Node version [e.g. 8.10.0] 11.0.0
  • Node installation method [e.g. nvm]
  • If applicable, compiler version [e.g. clang 3.8.0-2ubuntu4]
  • Package name and version [e.g. [email protected]] 1.15.1

Additional context

Add any other context about the problem here. If possible, attach full logs. Do not try to omit anything for brevity, but instead include absolutely everything. Please try and set your operating system's locale to English, so that logs contain error messages in the English language.

lafama avatar Oct 25 '18 13:10 lafama

This looks like we have a broken source distribution for 1.15.1...

nicolasnoble avatar Oct 25 '18 16:10 nicolasnoble

I don't know what's going on with that source distribution. I tried it myself and it works, and that file is present and in the include paths.

murgatroid99 avatar Oct 25 '18 16:10 murgatroid99

Maybe it's a Node 11 thing? Did you try with this runtime?

nicolasnoble avatar Oct 25 '18 16:10 nicolasnoble

So I just tried installing @google-cloud/language on my macbook with node 11 installed from nvm, and things worked properly fallbacking on compiling from source, so we're not able to reproduce this one.

nicolasnoble avatar Oct 25 '18 17:10 nicolasnoble

From https://github.com/grpc/grpc/issues/17011 - there IS something going on, it's sporadic, and horribly feels like a race condition. I don't know where the race is yet, but it's definitely related to node 11, and not with grpc itself.

nicolasnoble avatar Oct 26 '18 01:10 nicolasnoble

By the looks of it, there'll be a node 11.0.1 release soon, with issues in there that may be related to this. Please wait until this is released before attempting to use node 11.

nicolasnoble avatar Oct 26 '18 21:10 nicolasnoble

Thanks for investigating, we'll wait and see if things change with node 11.0.1 :)

jkwlui avatar Oct 26 '18 22:10 jkwlui

Works fine with Node 10.12.0

ojordann avatar Oct 27 '18 04:10 ojordann

Running Node v10.13.0 today and GRPC fails to install using npm i -S grpc Error:

node-pre-gyp ERR! Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.9.1/node-v64-linux-x64-musl.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI, musl) (falling back to source compile with node-gyp) 
node-pre-gyp ERR! Tried to download(undefined): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.9.1/node-v64-linux-x64-musl.tar.gz 
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v64 ABI, musl) (falling back to source compile with node-gyp) 
make: Entering directory '/var/www/app/current/node_modules/grpc/build'
make: Entering directory '/var/www/app/current/node_modules/grpc/build'
  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/surface/init.o
rm: can't remove './Release/.deps/Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o.d.raw': No such file or directory
make: *** [grpc.target.mk:394: Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o] Error 1
make: Leaving directory '/var/www/app/current/node_modules/grpc/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Linux 4.14.48-coreos-r2
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/var/www/app/current/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-musl/grpc_node.node" "--module_name=grpc_node" "--module_path=/var/www/app/current/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-musl"
gyp ERR! cwd /var/www/app/current/node_modules/grpc
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.o
gyp ERR! node -v v10.13.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/var/www/app/current/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-musl/grpc_node.node --module_name=grpc_node --module_path=/var/www/app/current/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-musl' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/var/www/app/current/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:962:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
node-pre-gyp ERR! System Linux 4.14.48-coreos-r2
node-pre-gyp ERR! command "/usr/bin/node" "/var/www/app/current/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /var/www/app/current/node_modules/grpc
node-pre-gyp ERR! node -v v10.13.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok 
Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/var/www/app/current/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-musl/grpc_node.node --module_name=grpc_node --module_path=/var/www/app/current/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-musl' (1)
Assembler messages:
Error: can't open /var/www/app/current/node_modules/grpc/ccDekbog.s for reading: No such file or directory
make: *** [grpc.target.mk:394: Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.o] Error 1
make: Leaving directory '/var/www/app/current/node_modules/grpc/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Linux 4.14.48-coreos-r2
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/var/www/app/current/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-musl/grpc_node.node" "--module_name=grpc_node" "--module_path=/var/www/app/current/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-musl"
gyp ERR! cwd /var/www/app/current/node_modules/grpc
gyp ERR! node -v v10.13.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
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.

Seems like this file: https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.9.1/node-v64-linux-x64-musl.tar.gz is not Publicly openned

nodeful avatar Nov 01 '18 10:11 nodeful

ArchLinux nodejs 11.0 fails EVERY time.

But with node 10.13 from nvm it works fine.

Here is my failing build log

jggc avatar Nov 01 '18 12:11 jggc

gyp ERR! configure error 
gyp ERR! stack Error: Command failed: /usr/bin/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>", line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                                ^
gyp ERR! stack SyntaxError: invalid syntax
gyp ERR! stack 
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:289:12)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:962:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)

...

gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "build" 
  "--fallback-to-build" 
  "--library=static_library" 
  "--module=/home/user/grpc-test/node_modules/grpc/src/node/extension_binary/node-v67-linux-x64-glibc/grpc_node.node" 
  "--module_name=grpc_node" 
  "--module_path=/home/user/grpc-test/node_modules/grpc/src/node/extension_binary/node-v67-linux-x64-glibc" 
  "--napi_version=3" 
  "--node_abi_napi=napi"
gyp ERR! cwd /home/user/grpc-test/node_modules/grpc
gyp ERR! node -v v11.0.0
gyp ERR! node-gyp -v v3.8.0

Let's have a look

$ python --version
Python 2.7.15

Same issue when switching to python3

$ python --version
Python 3.7.1

84564221 avatar Nov 01 '18 13:11 84564221

The original issue is about sporadic compilation failures under Node 11. If you are experiencing different errors under a different version of Node, please file a separate issue.

murgatroid99 avatar Nov 01 '18 15:11 murgatroid99

same issue here

node-pre-gyp ERR! node -v v11.0.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.3
node-pre-gyp ERR! not ok
Failed to execute '/Users/awe/.nvm/versions/node/v11.0.0/bin/node /Users/awe/.nvm/versions/node/v11.0.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/Users/awe/Desktop/code/project/era-cloud-proxy/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/Users/awe/Desktop/code/project/era-cloud-proxy/node_modules/grpc/src/node/extension_binary/node-v67-darwin-x64-unknown --napi_version=3 --node_abi_napi=napi' (1)
  CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.oexec install script
../deps/grpc/src/core/lib/backoff/backoff.cc:19:10: fatal error: 'grpc/support/port_platform.h' file not
      found
#include <grpc/support/port_platform.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.░⸩ ⠹ install: info lifecycle [email protected]~install: Failed to exec install script
make: *** [Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.o] Error 1

hilongjw avatar Nov 02 '18 06:11 hilongjw

reproduced using docker node:latest (11.1.0) and travis here. grpc compiles 2 times successfully, then on the third time it fails. The source binaries are not available yet as indicated with "Pre-built binaries not found for [email protected] and [email protected]"

christopher-johnson avatar Nov 03 '18 05:11 christopher-johnson

Found the rootcause. The culprit is mapbox/node-pre-gyp#426. A workaround for now with node 11 is to always add the --build-from-source option on npm install, which won't attempt an http download, and won't trigger the problem.

nicolasnoble avatar Nov 03 '18 06:11 nicolasnoble

@nicolasnoble dude, you're a genius. You saved me from all the frustrations that I was building up due to this issue for the past week! Way to go!

smtapp-smtio-cloud avatar Nov 04 '18 01:11 smtapp-smtio-cloud

@nicolasnoble what about yarn?

itaied246 avatar Nov 04 '18 20:11 itaied246

We've never officially supported yarn as a distribution system.

nicolasnoble avatar Nov 04 '18 21:11 nicolasnoble

I have the same problem running MacOS High Sierra using homebrew to install node and the installed version is 11.0. Build from sources option did not work. Solution: I force downgraded node to v10 and install went fine.

malkhalaf avatar Nov 05 '18 09:11 malkhalaf

+1 here, impossible to build today :

NPM version : 6.4.1
Node version : v11.1.0

> [email protected] install /app/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.13.1/node-v67-linux-x64-musl.tar.gz
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v67 ABI, musl) (falling back to source compile with node-gyp)
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v67 ABI, musl) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error Connection closed while downloading tarball file
gypgyp ERR! configure error

In the browser, the requested url show a :

<Error>
<Code>AccessDenied</Code>
<Message>Access denied.</Message>
<Details>
Anonymous caller does not have storage.objects.get access to grpc-precompiled-binaries/node/grpc/v1.13.1/node-v67-linux-x64-musl.tar.gz.
</Details>
</Error>

jscti avatar Nov 05 '18 11:11 jscti