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
[email protected] 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 [email protected] and [email protected] (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 [email protected] No repository field.
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! /home/gary/.npm/_logs/2019-06-20T08_52_53_291Z-debug.log
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
:~/Desktop/New/Anubhav$ npm install grpc@1.20.2 -S [email protected] install /home/anubhav/Desktop/New/Anubhav/node_modules/@firebase/firestore/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(404): https://node-precompiled-binaries.grpc.io/grpc/v1.20.0/node-v72-linux-x64-glibc.tar.gz node-pre-gyp WARN Pre-built binaries not found for grpc@1.20.0 and [email protected] (node-v72 ABI, glibc) (falling back to source compile with node-gyp)
Hi, I am facing the same issue but the problem in my case is I think while trying yo install grpc version 1.20.2 the node-pre-gyp is downloding libraries for 1.20.0
I am facing the same problem. `npm info lifecycle [email protected]~install: [email protected]
[email protected] 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 [email protected]
node-pre-gyp info using [email protected] | 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 [email protected] and [email protected] (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 [email protected]
gyp info using [email protected] | darwin | x64
gyp info ok
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | 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 "
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 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 `
Downgrading Node.js from 12 to 10 works as well.
Downgrading Node.js from 12 to 10 works as well.
Thank you! I've run about 25 different commands today trying to install the dependencies for a project on a new machine with a fresh Node.js install (v12). Going back to v10 worked like a charm.
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
This error showed up for me in node 12.14.1 and 13.5.0. Downgrading to 10.18.0 resolved the error.
Upgrading grpc to 1.24.2 seems to solve this problem, even with node 12.14.1
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.
I have the same issue and cannot downgrade to node 10 because some packages rely on 12. I've had no issues in the past I dont understand why this is happening all of a sudden..
@sprotznock85 Amazing, your solution of npm install request solved my problem with Node@12 & [email protected]
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v72 ABI, glibc) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error bad download
Related fail logs before doing this: https://github.com/Chatie/grpc/runs/628529052?check_suite_focus=true#step:6:646
late but anyone who must use needle for downloading:
node-pre-gyp WARN Using needle for node-pre-gyp https downloadcan fix this issue by installing request first:
npm install requestThen, install grpc as usual:
npm install grpcThis 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.
This worked for me as well. Thank you!
We stared experiencing random CI errors like some of you, a few weeks ago
node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (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 ?
late but anyone who must use needle for downloading:
node-pre-gyp WARN Using needle for node-pre-gyp https downloadcan fix this issue by installing request first:
npm install requestThen, install grpc as usual:
npm install grpcThis 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.
Can u help me?? I need help in same issue i did try ur solution didnt quite work out for me Thanks in Advance..Sorry m kinda new in JS Sorry for my bad english
So my issue was that my default compiler was clang-11 (which did not want to play nice), fixed it by doing export CXX=g++.
Btw, I'm running NixOS so might not be the same problem.
Thought I'd just add this here in case anyone else has the same issue
I was able to get it working on node 17 by replacing the grpc package with @grpc/grpc-js, and generating the proto files with the grpc_js option like:
# Generate js
yarn run grpc_tools_node_protoc \
--js_out=import_style=commonjs,binary:${OUTPUT_DIR} \
--grpc_out=grpc_js:${OUTPUT_DIR} \
--plugin=protoc-gen-grpc=./node_modules/.bin/grpc_tools_node_protoc_plugin \
-I ${PROTO_DIR} \
${PROTO_DIR}/*.proto
# Generate ts
yarn run grpc_tools_node_protoc \
--plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts \
--ts_out=grpc_js:${OUTPUT_DIR} \
-I ${PROTO_DIR} \
${PROTO_DIR}/*.proto
Also, to make it compile without errors (with typescript), I had to do some generics juggling to use private variables in my services: https://github.com/agreatfool/grpc_tools_node_protoc_ts/issues/79#issuecomment-890109586