Coder Social home page Coder Social logo

npm install grpc fail about grpc-node HOT 12 CLOSED

grpc avatar grpc commented on September 23, 2024
npm install grpc fail

from grpc-node.

Comments (12)

ssolbak avatar ssolbak commented on September 23, 2024 2

Im having that same issue. If you run node 8.8 or 8.9 on an AWS EB image and one dependency

"dependencies": {
"grpc" : "1.8.0"
}

It will then fail downloading the prebuilt binaries and try to compile from source and get a permissions issue. Error logs below.

[email protected] install /tmp/deployment/application/node_modules/grpc
node-pre-gyp install --fallback-to-build --library=static_library

node-pre-gyp ERR! Tried to download(undefined): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.8.0/node-v57-linux-x64-glibc.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v57 ABI, glibc) (falling back to source compile with node-gyp)
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir '/tmp/deployment/application/node_modules/grpc/build'
gyp ERR! System Linux 4.9.70-25.242.amzn1.x86_64
gyp ERR! command "/opt/elasticbeanstalk/node-install/node-v8.9.3-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v8.9.3-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--library=static_library" "--module=/tmp/deployment/application/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-glibc/grpc_node.node" "--module_name=grpc_node" "--module_path=/tmp/deployment/application/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-glibc"
gyp ERR! cwd /tmp/deployment/application/node_modules/grpc
gyp ERR! node -v v8.9.3
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 '/opt/elasticbeanstalk/node-install/node-v8.9.3-linux-x64/bin/node /opt/elasticbeanstalk/node-install/node-v8.9.3-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --library=static_library --module=/tmp/deployment/application/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-glibc/grpc_node.node --module_name=grpc_node --module_path=/tmp/deployment/application/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-glibc' (1)
node-pre-gyp ERR! stack at ChildProcess. (/tmp/deployment/application/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:925:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Linux 4.9.70-25.242.amzn1.x86_64
node-pre-gyp ERR! command "/opt/elasticbeanstalk/node-install/node-v8.9.3-linux-x64/bin/node" "/tmp/deployment/application/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /tmp/deployment/application/node_modules/grpc
node-pre-gyp ERR! node -v v8.9.3
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok
Failed to execute '/opt/elasticbeanstalk/node-install/node-v8.9.3-linux-x64/bin/node /opt/elasticbeanstalk/node-install/node-v8.9.3-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --library=static_library --module=/tmp/deployment/application/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-glibc/grpc_node.node --module_name=grpc_node --module_path=/tmp/deployment/application/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-glibc' (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

from grpc-node.

Yemolai avatar Yemolai commented on September 23, 2024

I have the same problem, running Windows 10 x64 build 1709 compilation 16299.125 with node 9.4.0, 8.9.4 and 8.5.0 I can't install any grpc-node version available as node-pre-gyp (it is using 0.6.39 even after I installed previous versions) can't download the precompiled binaries (I can download the tarball from the exact url stated in the error using chrome). It goes by the error:

> [email protected] install C:\Users\Gabriel\BitBucket\test\node_modules\grpc
> node-pre-gyp install --fallback-to-build --library=static_library

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

Using bash in Windows 10 I'm able to install grpc through npm. Could this be a node-pre-gyp problem with Windows?

from grpc-node.

murgatroid99 avatar murgatroid99 commented on September 23, 2024

Would you mind trying again with [email protected]? I have made some changes that may resolve this error.

from grpc-node.

Yemolai avatar Yemolai commented on September 23, 2024

@murgatroid99 no. same error. When node-pre-gyp tries to download the binary prebuilt files it gets the following error while trying to node-pre-gyp install into node_modules/grpc as the npm install grpc only tells that node-pre-gyp failed in download but does not give any reason for the fail

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] | win32 | x64
node-pre-gyp info check checked for "C:\Users\[...]\FirebaseDemo\node_modules\grpc\src\node\extension_binary\node-v57-win32-x64-unknown\grpc_node.node" (not found)
node-pre-gyp http GET https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.8.4/node-v57-win32-x64-unknown.tar.gz
node-pre-gyp ERR! install error
node-pre-gyp ERR! stack Error: self signed certificate in certificate chain
node-pre-gyp ERR! stack     at TLSSocket.<anonymous> (_tls_wrap.js:1103:38)
node-pre-gyp ERR! stack     at emitNone (events.js:106:13)
node-pre-gyp ERR! stack     at TLSSocket.emit (events.js:208:7)
node-pre-gyp ERR! stack     at TLSSocket._finishInit (_tls_wrap.js:637:8)
node-pre-gyp ERR! stack     at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:467:38)
node-pre-gyp ERR! System Windows_NT 10.0.16299
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install"
node-pre-gyp ERR! cwd C:\Users\[...]\FirebaseDemo\node_modules\grpc
node-pre-gyp ERR! node -v v8.9.4
node-pre-gyp ERR! node-pre-gyp -v v0.6.39
node-pre-gyp ERR! not ok
self signed certificate in certificate chain

But when I try to do the same using bash in windows it downloads the file correctly (obvious the linux one):

 [email protected] install /mnt/d/[...]/FirebaseDemo/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library

[grpc] Success: "/mnt/d/[...]/node_modules/grpc/src/node/extension_binary/node-v57-linux-x64-glibc/grpc_node.node" is installed via remote
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

+ [email protected]
added 150 packages in 19.871s

So can it be something related to the self-sign certificate in windows node-pre-gyp/node-gyp build for windows?

I tried in my workplace desktop with same Windows 10 x64 build and it installed without errors with node 8.9.4

from grpc-node.

nicolasnoble avatar nicolasnoble commented on September 23, 2024

So that last error means that the SSL certificate of storage.googleapis.com is self signed on your end, and the client is refusing to do anything with it.

This may mean several things. The unlikely reason is that you are being attacked by a third party who is trying to inject data into your HTTPS requests. The likely request is that you have some sort of transparent proxy at work which filters HTTPS, and your company has injected the proxy's root certificate in your machines, but since nodejs is using its own set of root certificates, node-pre-gyp isn't getting it, and is thus refusing the SSL connection, with good reasons, as it looks like a man-in-the-middle attack.

If I am right, and you have a MitM proxy at work, then you can either try to inject your company's root certificate into your nodejs installation (which I have no idea how to do), or to disable that check from nodejs completely by using the following environment variable: NODE_TLS_REJECT_UNAUTHORIZED=0. Note that this will leave you vulnerable to any certificate attack whatsoever, since node will no longer verify any ssl certificate. I would strongly suggest you confirm with your IT department that you indeed have a MitM proxy that does SSL rewriting, and see if it's possible to either disable the rewrite for that URL, or inject the certificate into your nodejs installation.

from grpc-node.

Yemolai avatar Yemolai commented on September 23, 2024

@nicolasnoble actually I work at the IT department where I tested grpc installation and I manage the proxy and firewall, so I can confirm we do not use a MitM proxy, maybe our internet provider does. In my home the connection is a common high-bandwidth cable modem connection and I'm connected directly into the modem, so, probably is a windows misconfiguration. I'll try another computer in my home network to test it and will try to find where the error is, but I'm almost sure this error is not a problem with grpc itself but to something related to node-gyp windows build or my home PC Windows OS.

from grpc-node.

nicolasnoble avatar nicolasnoble commented on September 23, 2024

That is definitely worrisome then. An ISP wouldn't do any MitM since they can't inject arbitrary ssl root certificates into your machines to make that work. Yes, this is a node-gyp issue, or even a node issue. Nothing to do with grpc.

If you want to troubleshoot, try the following:

$ npm install request
$ nodejs -e 'require("request")("https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.8.4/node-v57-win32-x64-unknown.tar.gz", (err, res, body) => console.log(err))'

And attempt different URLs to probe around. This will use nodejs' download engine, which should replicate node-pre-gyp's behavior.

For instance:

$ nodejs -e 'require("request")("https://self-signed.badssl.com/", (err, res, body) => console.log(err))'
{ [Error: self signed certificate] code: 'DEPTH_ZERO_SELF_SIGNED_CERT' }

from grpc-node.

nicolasnoble avatar nicolasnoble commented on September 23, 2024

This seems to be a more widespread issue than I thought, actually. Something Is Wrong With Node. See nodejs/node-gyp#695

from grpc-node.

Yemolai avatar Yemolai commented on September 23, 2024

Yeah, I'll try to investigate this problem further, when I try to make a request as you suggested I get the following error:

C:\Users\[...]\test>node .
grpc request: { Error: self signed certificate in certificate chain
    at TLSSocket.<anonymous> (_tls_wrap.js:1103:38)
    at emitNone (events.js:106:13)
    at TLSSocket.emit (events.js:208:7)
    at TLSSocket._finishInit (_tls_wrap.js:637:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:467:38) code: 'SELF_SIGNED_CERT_IN_CHAIN' }
badssl: { Error: self signed certificate
    at TLSSocket.<anonymous> (_tls_wrap.js:1103:38)
    at emitNone (events.js:106:13)
    at TLSSocket.emit (events.js:208:7)
    at TLSSocket._finishInit (_tls_wrap.js:637:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:467:38) code: 'DEPTH_ZERO_SELF_SIGNED_CERT' }

So definitely not a grpc error, nor node-pre-gyp/node-gyp, it is a problem with node's TLSSocket in windows as I use bash in windows and it works correctly:

yemolai@[...]:/mnt/d/[...]/test$ node .
badssl request: { Error: self signed certificate
    at TLSSocket.<anonymous> (_tls_wrap.js:1103:38)
    at emitNone (events.js:106:13)
    at TLSSocket.emit (events.js:208:7)
    at TLSSocket._finishInit (_tls_wrap.js:637:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:467:38) code: 'DEPTH_ZERO_SELF_SIGNED_CERT' }
grpc request: no error

I'll try to find what this error is and maybe open an issue in node TLSSocket repo related to this

from grpc-node.

Yemolai avatar Yemolai commented on September 23, 2024

Ok, turned off antivirus. Worked like a charm. That's just silly.

I've found here:
npm issue#7519

Kaspersky Anti-virus has an active invasive check into HTTPS connections that causes this kind of problem with npm. Tested with antivirus on and off and I can confirm that it is causing the problem.

After completely disabling Encrypted connections scanning all worked as intended.

from grpc-node.

awsaunier avatar awsaunier commented on September 23, 2024

I was having the same problem as above and I turned off Kaspersky and the install went perfectly.

from grpc-node.

nicolasnoble avatar nicolasnoble commented on September 23, 2024

Closing this one, as the rootcause is local antiviruses, and out of scope of gRPC.

from grpc-node.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.