Grpc-node: grpc_tools_node_protoc command not found

Created on 28 Aug 2019  路  3Comments  路  Source: grpc/grpc-node

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_plugin helloworld.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

Most helpful comment

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.

All 3 comments

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 !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Aswathi17 picture Aswathi17  路  3Comments

badoet picture badoet  路  4Comments

samiq picture samiq  路  5Comments

moloch-- picture moloch--  路  5Comments

tvk-codecraft picture tvk-codecraft  路  3Comments