protoc-gen-dart: Plugin failed with status code 127

1,768

I found the issue was with dart not set in environment variable.

Adding dart's path to ./zshrc or .profile will solve the issue

export PATH="$PATH:/Users/nk/projects/flutter/bin/cache/dart-sdk/bin"
Share:
1,768
Nikhil Kishore
Author by

Nikhil Kishore

Updated on December 23, 2022

Comments

  • Nikhil Kishore
    Nikhil Kishore over 1 year

    I am trying to use protobuf for dart but I am consistently getting following error

    --dart_out: protoc-gen-dart: Plugin failed with status code 127.

    I tried ./pub global activate protoc_plugin but that didn't help.

    echo $PATH
    /Users/nk/doc/gck/bin:/Users/nk/opt/anaconda3/bin:/Users/nk/opt/anaconda3/condabin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/nk/AndroidStudioProjects/el/flutter/bin:/Users/nk/.pub-cache/bin:/opt/apache-maven/bin
    

    I am getting an error when I am running

     protoc --dart_out=./lib/gen ./protos/test-event.proto
    
    /Users/nk/.pub-cache/bin/protoc-gen-dart: line 8: dart: command not found
    --dart_out: protoc-gen-dart: Plugin failed with status code 127.
    
    
    protoc --version
    libprotoc 3.13.0