【问题标题】:Could not make proto path relative: src/app/protos/greet.proto: No such file or directory无法使 proto 路径相对:src/app/protos/greet.proto:没有这样的文件或目录
【发布时间】:2020-10-31 19:08:09
【问题描述】:

我正在尝试按照文章创建一个 gRPC Angular 客户端: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/

运行命令时

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,

我收到一个错误Could not make proto path relative: src/app/protos/greet.proto: No such file or directory。目录和greet.proto文件肯定存在。

我请求有关此问题的帮助。提前谢谢!

【问题讨论】:

    标签: angular typescript grpc proto


    【解决方案1】:

    对于可能遇到这个问题的人,文章作者给出了解答。

    1. 该命令应在项目的根文件夹中运行。
    2. 这个编辑的命令有效:
    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
    

    【讨论】:

      猜你喜欢
      • 2018-03-11
      • 2020-07-26
      • 2021-01-12
      • 1970-01-01
      • 1970-01-01
      • 2016-10-19
      • 2015-10-22
      • 1970-01-01
      • 2013-06-14
      相关资源
      最近更新 更多