【发布时间】:2020-01-05 22:55:29
【问题描述】:
我正在尝试使用 protoc-plugin 将 proto 文件生成到 dart 文件,请遵循此指令 https://grpc.io/docs/quickstart/dart/ 但是当我运行此命令行时
protoc --dart_out=grpc:lib/proto --plugin=protoc-gen-dart=C:/src/flutter/flutter/.pub-cache/bin/protoc-gen-dart.bat -Iprotobuf protobuf/utils.proto
它显示了这个错误:
'dart' is not recognized as an internal or external command,
operable program or batch file.
'pub' is not recognized as an internal or external command,
operable program or batch file.
--dart_out: protoc-gen-dart: Plugin failed with status code 1.
我已经在我的 Android Studio 中安装了 dart 作为插件。是不是我必须安装 dart SDK 并将其添加到环境变量路径才能工作?
更新
在我安装 dart sdk 并重新启动我的电脑后它工作了。
【问题讨论】: