goprotocol-buffers80% confidence\u2191 5

Getting "protoc": executable file not found in $PATH when running "go generate" command

Full error message
We have an application written in GoLang and we are using GRPC for defining service contracts.

When we try to run "go generate" command to generate stub from proto file it gives following error:

main.go:4: running "protoc": exec: "protoc": executable file not found in $PATH

Command format in code:

//go:generate protoc -I . --go-grpc_out=. --go_out=.  ./proto/service.proto

Note:

I have already installed protoc-gen-go and protoc-gen-go-grpc
Tried to search for the above error but haven't been able to find a solution yet.

protoc-gen-go and protoc-gen-go-grpc are plugins for protoc. You need to install the protoc (the Protobuf compiler) itself, as explained in Go gRPC - Prerequisites. See protobuf - Releases page for a download. On a Mac can just use brew install protobuf.

API access

Get this solution programmatically \u2014 free, no authentication.

curl https://depscope.dev/api/error/e747f486c851b1826704aec5a4972203253d47d3b2eb72415f95703a3cd0bbdb
hash \u00b7 e747f486c851b1826704aec5a4972203253d47d3b2eb72415f95703a3cd0bbdb
Getting "protoc": executable file not found in $PA… — DepScope fix | DepScope