grpc / grpc-node

gRPC for Node.js
https://grpc.io
Apache License 2.0
4.48k stars 648 forks source link

grpc-tools package does not work with M3 Pro Mac #2646

Open Lukas-Kullmann opened 9 months ago

Lukas-Kullmann commented 9 months ago

Problem description

When I install grpc-tools and try to run code generation (i.e. node node_modules/.bin/grpc_tools_node_protoc [...]), I get an error

node_modules/.bin/grpc_tools_node_protoc [...]
node:internal/child_process:414
    throw errnoException(err, 'spawn');
    ^

Error: spawn Unknown system error -86
    at ChildProcess.spawn (node:internal/child_process:414:11)
    at spawn (node:child_process:761:9)
    at execFile (node:child_process:351:17)
    at Object.<anonymous> ([..]/node_modules/grpc-tools/bin/protoc.js:39:21)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:86:12)
    at node:internal/main/run_main_module:23:47 {
  errno: -86,
  code: 'Unknown system error -86',
  syscall: 'spawn'
}

Node.js v18.18.2

I then tried to run the command that the protoc.js file generates directly

node_modules/grpc-tools/bin/protoc --plugin=protoc-gen-grpc=node_modules/grpc-tools/bin/grpc_node_plugin [...]

But that gives me a different error

zsh: bad CPU type in executable: node_modules/grpc-tools/bin/protoc

Reproduction steps

See above.

Environment

Additional context

I don't think this library is responsible for building the binary that is not working for me, but I also don't know where else to report this error to.

sfarg0 commented 9 months ago

@Lukas-Kullmann any updates ?

Lukas-Kullmann commented 9 months ago

I installed rosetta (softwareupdate --install-rosetta via CLI) and now it works. Don't know why I need it though.

sfarg0 commented 9 months ago

Thanks :)