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

grpc_tools_node_protoc in [email protected] fails with ENOENT

Open josephharrington opened this issue 6 years ago • 9 comments

Problem description

When trying to run protoc from the [email protected] package on linux, it fails with "No such file or directory".

This also manifests as ENOENT when trying to run grpc_tools_node_protoc:

# ./node_modules/.bin/grpc_tools_node_protoc
/toolstest/node_modules/grpc-tools/bin/protoc.js:41
    throw error;
    ^

Error: spawn /toolstest/node_modules/grpc-tools/bin/protoc ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:246:19)
    at onErrorNT (internal/child_process.js:427:16)
    at processTicksAndRejections (internal/process/next_tick.js:76:17)
    at process.runNextTicks [as _tickCallback] (internal/process/next_tick.js:51:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:804:11)
    at internal/main/run_main_module.js:21:11

From what I can tell, this is due to the protoc executable being a 32-bit binary in 1.7.0, whereas it was a 64-bit binary in 1.6.6:

$ npm install [email protected] && file node_modules/grpc-tools/bin/protoc
node_modules/grpc-tools/bin/protoc: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.18, BuildID[sha1]=1b2e70e2faad598dfc7849be2c4bd1e11190dde7, stripped

$ npm install [email protected] && file node_modules/grpc-tools/bin/protoc
node_modules/grpc-tools/bin/protoc: ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=d2f865292439a6ba1bdf92921b0961c147916f01, not stripped

Reproduction steps

(run on macos via docker. similarly reproducible on linux.)

$ docker run --rm -it node /bin/bash
root:/# mkdir toolstest && cd toolstest/
root:/# npm install [email protected]
root:/# npx grpc_tools_node_protoc --version
spawn /toolstest/node_modules/grpc-tools/bin/protoc ENOENT

Environment

  • OS name, version and architecture: Ubuntu 16.04.5 LTS(xenial), and also reproducible on the node docker image mentioned above
  • Node version: 8.12.0 and 11.10.0
  • Node installation method: nvm and node docker image
  • Package name and version: [email protected]

Additional context

Here is the post that led me to believe this is related to the 64-bit/32-bit change: https://askubuntu.com/a/133460

josephharrington avatar Feb 20 '19 01:02 josephharrington

Thank you for reporting this. It looks like there was an error in our build process. I think I have fixed it for 1.7.0. Would you mind trying it again?

murgatroid99 avatar Feb 20 '19 17:02 murgatroid99

Awesome, looks like it's fixed now. Thank you!!

josephharrington avatar Feb 20 '19 18:02 josephharrington

I'm going to keep this open for now. I haven't resolved the underlying build problem yet; I just uploaded a fixed tarball.

murgatroid99 avatar Feb 20 '19 21:02 murgatroid99

I have a similar issue for node:10-alpine docker image

Reproduction steps

$ docker run --rm -it node:10-alpine /bin/sh
/ # uname -a
Linux 0000366c76ca 4.9.93-linuxkit-aufs #1 SMP Wed Jun 6 16:55:56 UTC 2018 x86_64 Linux
/ # npm install [email protected]
/ # ./node_modules/.bin/grpc_tools_node_protoc
...
Error: spawn /node_modules/grpc-tools/bin/protoc ENOENT
...

Protoc is not able to execute too

$ docker run --rm -it node:10-alpine /bin/sh
/ # uname -a
Linux 0000366c76ca 4.9.93-linuxkit-aufs #1 SMP Wed Jun 6 16:55:56 UTC 2018 x86_64 Linux
/ # apk add file
/ # npm install [email protected]
/ # ldd ./node_modules/grpc-tools/bin/protoc
	/lib64/ld-linux-x86-64.so.2 (0x7fde81e87000)
	libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7fde81e87000)
	libz.so.1 => /lib/libz.so.1 (0x7fde8130c000)
	libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x7fde80fb9000)
	libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fde81e87000)
	libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x7fde80da7000)
	libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fde81e87000)
/ # file ./node_modules/grpc-tools/bin/protoc
./node_modules/grpc-tools/bin/protoc: ELF 64-bit LSB shared object, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=2d784579976c37be032a47e0ebeddbcf1d3933b2, not stripped
/ # ./node_modules/grpc-tools/bin/protoc --version
/bin/sh: ./node_modules/grpc-tools/bin/protoc: not found
/ # 

theanurin avatar Mar 01 '19 11:03 theanurin

@theanurin: this is a different issue altogether, and this package will likely never work on Alpine Linux.

nicolasnoble avatar Mar 01 '19 16:03 nicolasnoble

@nicolasnoble Thanks! I was banging my head to the wall until I read your comment and switched to buster-slim. By the way, what is the problem with Alpine Linux?

garenyondem avatar Jul 31 '19 09:07 garenyondem

The problem with Alpine images is the lack of a glibc compatability layer. So either you apk it or protoc directly.

borfig avatar Dec 22 '20 07:12 borfig

I encountered this issue with [email protected] on alpine:3.14, and apk add libc6-compat was enough to resolve it.

nathanweeks avatar Oct 18 '21 09:10 nathanweeks

I encountered this issue with [email protected] on alpine:3.14, and apk add libc6-compat was enough to resolve it.

@nathanweeks It did solve it for me too, thanks! FTR: I'm working with docker image node:12.18.2-alpine3.12 and package [email protected]

emmveqz avatar Mar 24 '23 20:03 emmveqz