grpc-node: npm install grpc build from source fails

Having the issue on Fedora 29

Node: 10.16.0 npm: 6.9.0

Console output (abridged):

npm install grpc

grpc@1.21.1 install /home/gary/Source/storex_graphql_server/node_modules/grpc node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp WARN Using needle for node-pre-gyp https download node-pre-gyp WARN Tried to download(400): https://node-precompiled-binaries.grpc.io/grpc/v1.21.1/node-v64-linux-x64-glibc.tar.gz node-pre-gyp WARN Pre-built binaries not found for grpc@1.21.1 and node@10.16.0 (node-v64 ABI, glibc) (falling back to source compile with node-gyp) make: Entering directory ‘/home/gary/Source/storex_graphql_server/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/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/lib/channel/channel_args.o

CXX(target) Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.o …/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc: In function ‘grpc_grpclb_request* grpc_grpclb_request_create(const char*)’: …/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.cc:70:10: error: ‘char* strncpy(char*, const char*, size_t)’ specified bound 128 equals destination size [-Werror=stringop-truncation] strncpy(req->initial_request.name, lb_service_name,

        GRPC_GRPCLB_SERVICE_NAME_MAX_LENGTH);
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make: *** [grpc.target.mk:495: Release/obj.target/grpc/deps/grpc/src/core/ext/filters/client_channel/lb_policy/grpclb/load_balancer_api.o] Error 1
make: Leaving directory '/home/gary/Source/storex_graphql_server/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:198:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Linux 5.1.11-200.fc29.x86_64
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=/home/gary/Source/storex_graphql_server/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc/grpc_node.node" "--module_name=grpc_node" "--module_path=/home/gary/Source/storex_graphql_server/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc" "--napi_version=4" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v64"
gyp ERR! cwd /home/gary/Source/storex_graphql_server/node_modules/grpc
gyp ERR! node -v v10.16.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=/home/gary/Source/storex_graphql_server/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc/grpc_node.node --module_name=grpc_node --module_path=/home/gary/Source/storex_graphql_server/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/gary/Source/storex_graphql_server/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:198:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:982:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
node-pre-gyp ERR! System Linux 5.1.11-200.fc29.x86_64
node-pre-gyp ERR! command "/usr/bin/node" "/home/gary/Source/storex_graphql_server/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /home/gary/Source/storex_graphql_server/node_modules/grpc
node-pre-gyp ERR! node -v v10.16.0
node-pre-gyp ERR! node-pre-gyp -v v0.13.0
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=/home/gary/Source/storex_graphql_server/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc/grpc_node.node --module_name=grpc_node --module_path=/home/gary/Source/storex_graphql_server/node_modules/grpc/src/node/extension_binary/node-v64-linux-x64-glibc --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v64' (1)
npm WARN basic_server@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc@1.21.1 install: `node-pre-gyp install --fallback-to-build --library=static_library`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the grpc@1.21.1 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!     /home/gary/.npm/_logs/2019-06-20T08_52_53_291Z-debug.log

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 3
  • Comments: 16 (1 by maintainers)

Commits related to this issue

Most upvoted comments

Downgrading Node.js from 12 to 10 works as well.

late but anyone who must use needle for downloading:

node-pre-gyp WARN Using needle for node-pre-gyp https download

can fix this issue by installing request first:

npm install request

Then, install grpc as usual:

npm install grpc

This is because node-pre-gyp has the following code snippet during install process:

try {
  http_get.impl = require('request');
  http_get.type = 'request';
  log.warn("Using request for node-pre-gyp https download");
} catch (e) {
  http_get.impl = require('needle');
  http_get.type = 'needle';
  log.warn("Using needle for node-pre-gyp https download");
}

So request is not used because any package.json does not have request. Pre installing request fixes this issue for me. Important to say that all cafile options must be removed from any npm config ssl can be set to true again as well as NODE_TLS_REJECT_UNAUTHORIZED to true.

We stared experiencing random CI errors like some of you, a few weeks ago

node-pre-gyp WARN Pre-built binaries not installable for grpc@1.24.2 and node@12.16.3 (node-v72 ABI, glibc) (falling back to source compile with node-gyp) 
node-pre-gyp WARN Hit error bad download 

And the solution of installing request before starting our npm install works. Thank you a lot for that @sprotznock85. But that’s a hack and request is deprecated since february 2020, so we would like to understand and find a long term solution. Did you @sprotznock85 or someone else understand why downloading with request work and not with needle ?

I am facing the same problem. `npm info lifecycle grpc@1.20.0~install: grpc@1.20.0

grpc@1.20.0 install /Users/user/Documents/codebase/project-name/node_modules/@firebase/firestore/node_modules/grpc node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp info it worked if it ends with ok node-pre-gyp info using node-pre-gyp@0.12.0 node-pre-gyp info using node@12.6.0 | darwin | x64 node-pre-gyp WARN Using request for node-pre-gyp https download node-pre-gyp info check checked for “/Users/user/Documents/codebase/project-name/node_modules/@firebase/firestore/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown/grpc_node.node” (not found) node-pre-gyp http GET https://node-precompiled-binaries.grpc.io/grpc/v1.20.0/node-v72-darwin-x64-unknown.tar.gz node-pre-gyp WARN Pre-built binaries not installable for grpc@1.20.0 and node@12.6.0 (node-v72 ABI, unknown) (falling back to source compile with node-gyp) node-pre-gyp WARN Hit error self signed certificate in certificate chain gyp info it worked if it ends with ok gyp info using node-gyp@3.8.0 gyp info using node@12.6.0 | darwin | x64 gyp info ok gyp info it worked if it ends with ok gyp info using node-gyp@3.8.0 gyp info using node@12.6.0 | darwin | x64 gyp ERR! configure error gyp ERR! stack Error: Command failed: /usr/local/opt/python/libexec/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:297:12) gyp ERR! stack at ChildProcess.emit (events.js:203:13) gyp ERR! stack at maybeClose (internal/child_process.js:1021:16) gyp ERR! stack at Socket.<anonymous> (internal/child_process.js:430:11) gyp ERR! stack at Socket.emit (events.js:203:13) gyp ERR! stack at Pipe.<anonymous> (net.js:588:12) gyp ERR! System Darwin 18.6.0 gyp ERR! command “/usr/local/Cellar/node/12.6.0/bin/node” “/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” “configure” “–fallback-to-build” “–library=static_library” “–module=/Users/user/Documents/codebase/project-name/node_modules/@firebase/firestore/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown/grpc_node.node” “–module_name=grpc_node” “–module_path=/Users/user/Documents/codebase/project-name/node_modules/@firebase/firestore/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown” “–napi_version=4” “–node_abi_napi=napi” “–napi_build_version=0” “–node_napi_label=node-v72” “–python=/usr/local/opt/python/libexec/bin/python” gyp ERR! cwd /Users/user/Documents/codebase/project-name/node_modules/@firebase/firestore/node_modules/grpc gyp ERR! node -v v12.6.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/local/Cellar/node/12.6.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --library=static_library --module=/Users/user/Documents/codebase/project-name/node_modules/@firebase/firestore/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/Users/user/Documents/codebase/project-name/node_modules/@firebase/firestore/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72 --python=/usr/local/opt/python/libexec/bin/python’ (1) node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/Users/user/Documents/codebase/project-name/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:203:13) node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1021:16) node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) node-pre-gyp ERR! System Darwin 18.6.0 node-pre-gyp ERR! command “/usr/local/Cellar/node/12.6.0/bin/node” “/Users/user/Documents/codebase/project-name/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/user/Documents/codebase/project-name/node_modules/@firebase/firestore/node_modules/grpc node-pre-gyp ERR! node -v v12.6.0 node-pre-gyp ERR! node-pre-gyp -v v0.12.0 node-pre-gyp ERR! not ok Failed to execute ‘/usr/local/Cellar/node/12.6.0/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --library=static_library --module=/Users/user/Documents/codebase/project-name/node_modules/@firebase/firestore/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown/grpc_node.node --module_name=grpc_node --module_path=/Users/user/Documents/codebase/project-name/node_modules/@firebase/firestore/node_modules/grpc/src/node/extension_binary/node-v72-darwin-x64-unknown --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72 --python=/usr/local/opt/python/libexec/bin/python’ (1) npm info lifecycle grpc@1.20.0~install: Failed to exec install script npm timing action:install Completed in 2405ms npm timing stage:rollbackFailedOptional Completed in 784ms npm timing stage:runTopLevelLifecycles Completed in 46436ms npm WARN bootstrap@4.3.1 requires a peer of jquery@1.9.1 - 3 but none is installed. You must install peer dependencies yourself. npm WARN bootstrap@4.3.1 requires a peer of popper.js@^1.14.7 but none is installed. You must install peer dependencies yourself. npm WARN @firebase/performance@0.2.1 requires a peer of @firebase/app@0.x but none is installed. You must install peer dependencies yourself. npm WARN @firebase/performance@0.2.1 requires a peer of @firebase/app-types@0.x but none is installed. You must install peer dependencies yourself. npm WARN @firebase/firestore@1.2.2 requires a peer of @firebase/app@0.x but none is installed. You must install peer dependencies yourself. npm WARN @firebase/firestore@1.2.2 requires a peer of @firebase/app-types@0.x but none is installed. You must install peer dependencies yourself. npm WARN @firebase/firestore-types@1.2.1 requires a peer of @firebase/app-types@0.x but none is installed. You must install peer dependencies yourself. npm WARN @firebase/installations@0.1.0 requires a peer of @firebase/app@0.x but none is installed. You must install peer dependencies yourself. npm WARN @firebase/installations@0.1.0 requires a peer of @firebase/app-types@0.x but none is installed. You must install peer dependencies yourself. npm WARN @firebase/installations-types@0.1.0 requires a peer of @firebase/app-types@0.x but none is installed. You must install peer dependencies yourself. npm WARN digiworld@0.18.1-test-Sept.1 No repository field.

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! grpc@1.20.0 install: node-pre-gyp install --fallback-to-build --library=static_library npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the grpc@1.20.0 install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm timing npm Completed in 47669ms

npm ERR! A complete log of this run can be found in: npm ERR! /Users/user/.npm/_logs/2019-10-09T19_40_13_906Z-debug.log `

This error showed up for me in node 12.14.1 and 13.5.0. Downgrading to 10.18.0 resolved the error.

Downgrading Node.js from 12 to 10 works as well.

This worked for me as well, downloaded to node-v10.17.0 npm 6.11.3

Upgrading grpc to 1.24.2 seems to solve this problem, even with node 12.14.1

It’s odd that you could not download the prebuilt binaries … I just did so using Fedora 29 and Node 10.16.

In any case, there still seems to be a residual issue compiling gRPC-core using gcc/g++ 8.x.

You can work around this by setting the CXXFLAGS environment variable: export CXXFLAGS=-Wno-error