protoc-gen-swagger command not found

In this troubleshooting guide we learn how to fix protoc-gen-swagger command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

protoc-gen-swagger: command not found

or when using sudo you get the following error message

sudo: protoc-gen-swagger: command not found

Solutions to protoc-gen-swagger: command not found

How To Fix protoc-gen-swagger: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu protoc-gen-swagger is provided by golang-grpc-gateway package.

golang-grpc-gateway is:

Grpc-gateway is a protoc plugin that reads gRPC service definitions and generates a reverse-proxy server which translates a RESTful JSON API into gRPC. The server is generated according to custom options in your gRPC definition and helps you to provide your APIs in both gRPC and RESTful style at the same time.

This package contains the generator binaries.

To fix this problem, we can install more using the command below.

sudo apt-get -y install golang-grpc-gateway

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install golang-grpc-gateway.

sudo apt -y install golang-grpc-gateway

Or if you have aptitude installed you can use the following command.

sudo aptitude install golang-grpc-gateway

Summary

In this tutorial we learn how to fix protoc-gen-swagger command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.