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.

npm install grpc build from source fails

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:3
  • Comments:16 (1 by maintainers)

github_iconTop GitHub Comments

69reactions
Infl1ghtcommented, Nov 7, 2019

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

21reactions
sprotznock85commented, Apr 8, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - Can't install grpc npm-package
That error is the problem. It means that you failed to connect to the server that provides the binary packages that grpc uses,...
Read more >
npm install grpc is failing on ubuntu 16.04.
I'm trying to install grpc on ubuntu 16.04. But it is failing with below error. I have installed libgrpc-dev and libgrpc0. Not sure...
Read more >
grpc/grpc-js
Pure JavaScript gRPC Client. Installation. Node 12 is recommended. The exact set of compatible Node versions can be found in the engines field ......
Read more >
falling back to source compile with node-gyp
npm ERR ! Failed at the grpc@1.24.2 install script. npm ERR! This is probably not a problem with npm. There is likely additional...
Read more >
Quick start | C++
Build and locally install gRPC and Protocol Buffers ... If you'd rather use bazel, see Building from source. ... Getting build failures?
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