The command "pub" is either misspelled or could not be found
- Dominant language
- Dart
- Stars
- 572
- Forks
- 196
- Avg merge
- 1h 59m
- Merged PRs (30d)
- 2
Description
We migrated from flutter 1x to flutter 2.2.0.
**Environment**
* Windows 10
* flutter 2.2.0
* dart 2.13.0 (installed by flutter)
* protoc 3.17.0
* protoc_plugin 20.0.0 (installed with `flutter pub global activate protoc_plugin 20.0.0`)
**Issue**
Running `protoc --dart_out=grpc [...]` generates the fowllowing (german) error:
```
Der Befehl "pub" ist entweder falsch geschrieben oder konnte nicht gefunden werden.
--dart_out: protoc-gen-dart: Plugin failed with status code 1.
```
(Probably `The command "pub" is either misspelled or could not be found`)
The `protoc-gen-dart.bat` contains the following line:
```
pub global run protoc_plugin:protoc_plugin %*
```
The folder `flutter\bin` only contains the following files:
* flutter
* flutter.bat
* dart
* dart,bat
The folger `flutter\bin\cache\dart-sdk\bin` contains:
* dart.exe
* pub.bat
The command `pub` does not exists in any dart folder.
**Workaround**
I added `dart` in front of `pub` within the `protoc-gen-dart.bat`:
```
dart pub global run protoc_plugin:protoc_plugin %*
```
Now, `protoc --dart_out=grpc [...]` generates the dart files.
**Conclusion**
The `protoc-gen-dart.bat` is not generated correct.
Contributor guide
Research direction
Start by locating the generator or template that produces protoc-gen-dart.bat, then inspect how the Windows launcher invokes protoc_plugin. Reproduce the failure with the listed Flutter, Dart, protoc, and protoc_plugin versions, and confirm that protoc --dart_out=grpc succeeds without the manual workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100