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
Release: 2024-12-21 07:43:10
Original
106 people have browsed it

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
Copy after login

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.
Copy after login

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
    Copy after login
  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
      Copy after login

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!

source:php.cn
Statement of this Website
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
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template