Search code examples
angulartypescriptgrpcproto

Could not make proto path relative: src/app/protos/greet.proto: No such file or directory


enter image description here

I am trying to create a gRPC Angular client following the article: https://anthonygiretti.com/2020/03/29/grpc-asp-net-core-3-1-how-to-create-a-grpc-web-client-examples-with-angular-8-and-httpclient/

While running the command

protoc --plugin=protoc-gen-ts="{ABSOLUTEPATH}\node_modules\.bin\protoc-gen-ts.cmd" 
       --js_out="import_style=commonjs,binary:src/app/generated" 
       --ts_out="service=grpc-web:src/app/generated" src/app/protos/greet.proto,

I get an error Could not make proto path relative: src/app/protos/greet.proto: No such file or directory. The directory and greet.proto file definitely exist.

I request help with this issue. Thank you in advance!


Solution

  • For those who may encounter this issue, the author of the article gave an answer.

    1. The command should be run in a root folder of the project.
    2. This edited command worked:
    protoc --plugin=protoc-gen-ts="C:/University/IT/Angular_grpc/angular-client/node_modules/ts-protoc-gen/bin/protoc-gen-ts.cmd" --js_out="import_style=commonjs,binary:src/app/generated" --ts_out="service=grpc-web:src/app/generated" src/app/protos/greet.proto