Protobuf: protoc-gen-go-grpc: program not found or is not executable when using APIv2

Created on 23 Oct 2020  路  6Comments  路  Source: golang/protobuf

I've been searching #1053 and #3453 searching, finally I am here. When trying to $ make build I get the error:

protoc -I . speak.proto --go_out=plugins=grpc:.
protoc-gen-go: program not found or is not executable
Please specify a program using absolute path or make sure the program is available in your PATH system variable
--go_out: protoc-gen-go: Plugin failed with status code 1.
make: * [build] Error 1

I have tried following and installing and going on and on but can't seem to get this error to go away.
my make file is:

build:
    protoc -I . speak.proto --go_out=plugins=grpc:.

I have tried installing with

go get google.golang.org/grpc/cmd/protoc-gen-go-grpc
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc

and my paths look like

export GOPATH=$HOME/Documents/goworkspace
export PATH=$PATH:$HOME/go/bin 
export PATH=$PATH:/usr/local/go/bin

I'm not sure if that's correct as there have been so many conflicting responses as to how it should be set.
What else am I missing? I have sourced my .zshrc, restarted my terminal, and restarted my laptop but to no avail

Most helpful comment

SOLVED: updated path to:

export GOPATH=$HOME/Documents/goworkspace
export PATH="$PATH:$GOPATH/bin"

All 6 comments

Executing go get google.golang.org/grpc/cmd/protoc-gen-go-grpc installs protoc-gen-go-grpc, not protoc-gen-go.

Perhaps you need go install google.golang.org/protobuf/cmd/protoc-gen-go as well?

The error clearly indicates protoc-gen-go as the missing binary, not protoc-gen-go-grpc.

thanks for the reply!

I was looking at that, and there have been very recent changes to the protobuf package. I have looked at the error and have about 20 tabs open with the same issue and 20 different tabs saying 20 different things. I have already go get google.golang.org/grpc/cmd/protoc-gen-go-grpc as well as done go install google.golang.org/protobuf/cmd/protoc-gen-go
same issue persists

If you already ran go install google.golang.org/protobuf/cmd/protoc-gen-go and protoc still can't find the command, then the issues likely due to the PATH environment variable not set up.

Are you certain that your PATH environment variable contains the directory where go install outputs the binary?

I am pretty sure, my PATH Environment is:

export GOPATH=$HOME/Documents/goworkspace
#export PATH=$PATH:$HOME/go/bin 
export PATH=$PATH:/usr/local/go/bin
# export PATH=${HOME}/go/bin/protoc-gen-go

If I uncomment export PATH=${HOME}/go/bin/protoc-gen-go then I get a bunch of errors in my terminal

/usr/local/Cellar/powerlevel9k/0.6.7/functions/utilities.zsh:82: command not found: uname
/Users/cfrancia/.oh-my-zsh/oh-my-zsh.sh:69: command not found: rm
detect-clipboard:33: command not found: uname
prompt_context:13: command not found: whoami
prompt_background_jobs:1: command not found: wc
prompt_background_jobs:2: command not found: awk

SOLVED: updated path to:

export GOPATH=$HOME/Documents/goworkspace
export PATH="$PATH:$GOPATH/bin"

SOLVED: updated path to:

export GOPATH=$HOME/Documents/goworkspace
export PATH="$PATH:$GOPATH/bin"

thank you

Was this page helpful?
0 / 5 - 0 ratings