10

I am following this C# Quickstart tutorial for gRPC. I have come to this step where I have to use the following command to generate gRPC code:

%UserProfile%\.nuget\packages\Grpc.Tools.1.15.0\tools\windows_x86\protoc.exe -I../../protos --csharp_out Greeter --grpc_out Greeter ../../protos/helloworld.proto --plugin=protoc-gen-grpc=%UserProfile%\.nuget\packages\packages\Grpc.Tools.1.15.0\tools\windows_x86\grpc_csharp_plugin.exe

It doesn't work and what I get in the terminal after running commands above is this:

--grpc_out: protoc-gen-grpc: The system cannot find the path specified.

I don't know why the system cannot find the path since I have changed the path in the command so that it points to the files which need to be executed.

Community
  • 1
  • 1
Gal Eržen Pajič
  • 111
  • 1
  • 1
  • 7
  • protoc is not generating the files itself. it starts subprograms and passes the parsed file to them. Afaict it tries to execute `protoc-gen-grpc`, but is not finding it in the PATH (a system environment variable containing a list of folders to search for executables). – ZeissS Nov 05 '18 at 19:50
  • So if I had it in PATH I should get something if I just entered protoc-gen-grpc into cmd? Because at the moment I get 'command not found' message. – Gal Eržen Pajič Nov 05 '18 at 20:37

4 Answers4

7

I considered the answer by Michael. However, using a different user account was not an option and I couldn't rename my user account since it's an Azure AD user and as such does not have an entry in the Windows list of local users where I would change its folder location in the registry.

The work-around that did it for me was to change the location of the global packages folder.

bgh
  • 1,986
  • 1
  • 27
  • 36
6

I had the same error because had cyrillyc symbols in my user folder. Solved by changing path to global nuget packages in nuget file config (for Windows: %appdata%\NuGet\NuGet.config):

<configuration>
  <config>
    <add key="globalPackagesFolder" value="D:\.nuget\packages" />
  </config>
</configuration>

Instead of D:\.nuget\packages you can set any path without wrong symbols

Roman Yakhmenev
  • 101
  • 1
  • 8
5

Can you try passing an absolute path to --plugin=protoc-gen-grpc=?

Noah Eisen
  • 268
  • 1
  • 6
  • Thank you for your help. I tried it and it didn't work, I think I should do something else along with what you proposed. Meanwhile I have learned that I will not be using protobuf for what I want to do. – Gal Eržen Pajič Nov 08 '18 at 09:50
  • Even though `grpc_cpp_plugin.exe` was in my path, `protoc` required the absolute path to it. – jonface Jul 02 '20 at 09:19
4

I ran into the same problem, and with this error "path not found" and your name containing special characters as well, I suspected an issue with non ASCII paths! It happened that my windows username had a special character "ë" in it

You should create a github issue, but here are some quick fixes:

2 solutions here to fix the issue

  1. Create a new user without special characters and use this account
  2. Harder and dangerous path, but what I've done myself: rename your user account to remove special characters using the following method https://winaero.com/blog/rename-user-profile-folder-windows-10/
Michael
  • 791
  • 9
  • 9
  • 2
    I had this same problem when using Visual Studio 2019 and Grpc.Tools. Turned out that the problem was the special character in my username, probably related to where nuget stores the packages used(?). – tobbenb3 Mar 18 '20 at 14:43