I wanna build a microservice with gRPC in Nodejs, but I got an error.
I installed [email protected]
and [email protected]
, but when I enter this command:
grpc_tools_node_protoc --js_out=import_style=commonjs,binary:./generated --grpc_out=./generated --proto_path=./protos ./protos/*.proto
I get this error:
\AppData\Roaming\npm\node_modules\grpc-tools\bin\protoc.js:41
throw error;
^
Error: Command failed: \AppData\Roaming\npm\node_modules\grpc-tools\bin\protoc.exe --plugin=protoc-gen-grpc=\AppData\Roaming\npm\node_modules\grpc-tools\bin\grpc_node_plugin.exe --js_out=import_style=commonjs,binary:./generated --grpc_out=./generated --proto_path=./protos ./protos/*.proto
←[90m at ChildProcess.exithandler (child_process.js:303:12)←[39m
←[90m at ChildProcess.emit (events.js:315:20)←[39m
←[90m at maybeClose (internal/child_process.js:1026:16)←[39m
←[90m at Socket.<anonymous> (internal/child_process.js:441:11)←[39m
←[90m at Socket.emit (events.js:315:20)←[39m
←[90m at Pipe.<anonymous> (net.js:674:12)←[39m {
killed: ←[33mfalse←[39m,
code: ←[33m3221225781←[39m,
signal: ←[1mnull←[22m,
cmd: ←[32m'\\AppData\\Roaming\\npm\\node_modules\\grpc-tools\\bin\\protoc.exe --plugin=protoc-gen-grpc=\\AppData\\Roaming\\npm\\node_modules\\grpc-tools\\bin\\grpc_node_plugin.exe --js_out=import_style=commonjs,binary:./generated --grpc_out=./generated --proto_path=./protos ./protos/*.proto'←[39m
}
it drives me crazy :(
I don't know the exact cause and issue but downgrading
@grpc/grpc-js
to 1.6.6 andgrpc-tools
to 1.11.2 worked for me.