grpc-node
grpc-node copied to clipboard
grpc_tools_node_protoc in [email protected] fails with ENOENT
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
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?
Awesome, looks like it's fixed now. Thank you!!
I'm going to keep this open for now. I haven't resolved the underlying build problem yet; I just uploaded a fixed tarball.
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: this is a different issue altogether, and this package will likely never work on Alpine Linux.
@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?
The problem with Alpine images is the lack of a glibc compatability layer. So either you apk
it or protoc
directly.
I encountered this issue with [email protected] on alpine:3.14, and apk add libc6-compat
was enough to resolve it.
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]