Home >Backend Development >Golang >Why Does `protoc-gen-go-grpc` Fail with 'Program Not Found or Not Executable'?

Why Does `protoc-gen-go-grpc` Fail with 'Program Not Found or Not Executable'?

Patricia Arquette
Patricia ArquetteOriginal
2024-12-21 07:43:10108browse

Why Does `protoc-gen-go-grpc` Fail with

protoc-gen-go-grpc Error: "Program Not Found or Not Executable"

When attempting to generate GRPC output files from .proto files using the command:

protoc -I ./src/pbdefs/protos/ --go-grpc_out=. src/pbdefs/protos/*.proto

You may encounter the following error:

protoc-gen-go-grpc: 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-grpc_out: protoc-gen-go-grpc: Plugin failed with status code 1.

Solution:

This error indicates that the 'protoc-gen-go-grpc' plugin is missing. To resolve it:

  1. Install the Plugin:

    go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest
  2. Ensure the 'PATH' Environment Variable Includes the Plugin's Location:

    • Windows: Add the plugin's installation directory to the 'PATH' environment variable.
    • Linux/macOS: Add the following line to your '.bashrc' or '.zshrc' file:

      export PATH=$PATH:$GOPATH/bin

The above is the detailed content of Why Does `protoc-gen-go-grpc` Fail with 'Program Not Found or Not Executable'?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn