Import "google/protobuf/empty.proto" was not found or had errors.
zunaira1231 opened this issue · comments
on running the command protoc example.proto --go_out=plugins=grpc:.
i am getting a error:
example.proto: Import "google/protobuf/empty.proto" was not found or had errors.
example.proto: Import "google/protobuf/timestamp.proto" was not found or had errors.
Hi @zunaira1231, thanks for your issue. This happens if you haven't got access to the so called "well known types". These should be included with your protobuf installation. There's a few things you can try:
- Try adding
-I/usr/include
to yourprotoc
command, if you haveprotoc
installed in/usr/bin/protoc
. - Reinstall
protoc
by downloading and extracting the release to/usr/
. See https://github.com/protocolbuffers/protobuf/releases/tag/v3.9.1.
In either case, this is not an error in the current repo, but likely a problem with your protoc
installation.
hi / i had same issue for a long time .. im telling you the process worked for me hope it dose for you too :
go to this directory using your cmd : cd .local/include
this directory normally should contain some folder named "google" copy this folder and paste it to this directory : /usr/local/include
and now try the protoc engine again to generate your project and if the error still exists then try the rest of process :
navigate to that specific directory and check if its been copied or not . if it is then try to navigate to the folder from where you are (which it should be /usr/local/include) if the error says you have no permission to get in the folder
use this command to get the permission
$ sudo chmod o+r -R ./google
and then try to get permission to get in protobuf folder in the same directory using above command again
when its all done . check the protoc generator again /// hope works for you because it dose for me
import public "google/protobuf/empty.proto";