Great article. There are very few articles on typescript with gRPC.
I had to install grpc_tools_node_protoc_ts globally. Without it I got this error Failure: plugin ts: could not find protoc plugin for name ts
running buf generate --debug gave this error
Failure: plugin grpc: exec: "grpc_tools_node_protoc_plugin": executable file not found in $PATH
Great article. There are very few articles on typescript with gRPC.
I had to install
grpc_tools_node_protoc_tsglobally. Without it I got this errorFailure: plugin ts: could not find protoc plugin for name tsrunning
buf generate --debuggave this errorFailure: plugin grpc: exec: "grpc_tools_node_protoc_plugin": executable file not found in $PATHand after installing globally buf generate works
If locally installed, node_modules/.bin has to be in path.
If instead of invoking it directly, we add an npm script to invoke it, then that will be taken care of by npm/yarn.
In package.json
Thanks for this tip. Didn't quite work for me until I copied the way the line above was structured:
"scripts": {"start": "nodemon src/server/index.ts --watch src/server",
"start:client": "nodemon src/client/index.ts --watch src/client",
"proto:build": "cd proto; buf build; cd ..",
"codegen:buf": "cd proto; buf generate; cd .."
},