I follow README.md from static_codegen (examples/node). When I run this command
grpc_tools_node_protoc --js_out=import_style=commonjs,binary:../node/static_codegen/ --grpc_out=../node/static_codegen --plugin=protoc-gen-grpc=
which grpc_tools_node_protoc_pluginhelloworld.proto
I get an error:
-bash: grpc_tools_node_protoc: command not found
Protoc and grpc-tools have installed already.
libprotoc 3.9.1
[email protected]
node: v10.16.3
npm: 6.9.0
MacOS Mojave
That command is written assuming grpc-tools is installed globally, and it's a bit out of date. The --plugin=... argument is no longer needed. If you have the library installed locally, you can use ./node_modules/.bin/grpc_tools_node_protoc or alternatively you can write the command into an npm script and still use grpc_tools_node_protoc.
./scripts/pb_generator.sh
Input File: ./protos/*.proto
Output Dir: ./src/pb/
npx grpc_tools_node_protoc \
--js_out=import_style=commonjs,binary:./src/pb \
--grpc_out=./src/pb \
-I=./protos ./protos/*.proto
sh ./scripts/pb_generator.sh
hope this helps
Thanks a lot !
Most helpful comment
That command is written assuming
grpc-toolsis installed globally, and it's a bit out of date. The--plugin=...argument is no longer needed. If you have the library installed locally, you can use./node_modules/.bin/grpc_tools_node_protocor alternatively you can write the command into an npm script and still usegrpc_tools_node_protoc.