Dart GRPC Windows 10。无法生成代码

Dart GRPC Windows 10。无法生成代码,dart,grpc,Dart,Grpc,我正在遵循grpc的Dart快速入门指南。我试图在Windows 10上生成Dart代码,但出现以下错误: --dart_out: protoc-gen-dart: The system cannot find the file specified. --dart_out: protoc-gen-dart: The system cannot find the path specified. 我已在路径中添加了Pub\Cache\bin,并尝试了GRPC页面中《快速入门指南》中的命令: cd

我正在遵循grpc的Dart快速入门指南。我试图在Windows 10上生成Dart代码,但出现以下错误:

--dart_out: protoc-gen-dart: The system cannot find the file specified.
--dart_out: protoc-gen-dart: The system cannot find the path specified.
我已在路径中添加了Pub\Cache\bin,并尝试了GRPC页面中《快速入门指南》中的命令:

cd grpc-dart/example/helloworld
protoc --dart_out=grpc:lib/src/generated -Iprotos protos/helloworld.proto
我也尝试过这样指定完整路径:

protoc --dart_out=grpc:lib/src/generated -Iprotos protos/helloworld.proto --plugin=protoc-gen-dart=c:\Users\[myself]\AppData\Roaming\Pub\Cache\bin\protoc-gen-dart.bat
在这种情况下,我得到以下错误:

--dart_out: protoc-gen-dart: The system cannot find the file specified.
--dart_out: protoc-gen-dart: The system cannot find the path specified.

你知道我做错了什么吗?我已经成功地为C#和Go生成了代码,但我无法使它在Dart中工作。

我也是win 10,我也有同样的问题,我通过以下方法解决了:

  • 首先,您需要安装dart 2.x,然后您可以找到以下文件:
  • 获取插件:
  • 然后您可以运行以下命令:

再多解释一下为什么需要这样做,或者它是如何解决问题的,这将是一个更好的答案:)或者分享一种了解protoc_插件的方法。(我只是快速阅读,没有完整的上下文。)感谢您的贡献!这是我一直在尝试的,但那时候不起作用。我放弃了grpc休息。我以后可能再试一次,你成功了。Github帮助程序没有包括它是dart.bat,这是当您在不知道的文件中浏览时非常有用的信息。非常感谢;)所以这将起作用:protoc--proto_path=D:\Repos\\--plugin=grpc,protoc gen dart=C:\Users\\AppData\Roaming\Pub\Cache\bin\protoc-gen-dart.bat--dart_out=./system.proto但它生成的代码不处理空的或任何其他特殊类型,而且似乎没有关于如何创建它所期望的RpcClient(抽象)的文档。
C:\workspace\tools\protoc3.6.1\bin\protoc --plugin=protoc-gen-dart=C:\Users\[your user name]\AppData\Roaming\Pub\Cache\bin\protoc-gen-dart.bat --dart_out=./ ./xxxx.proto