flutterdart

Pub is not recognized as internal or external command


im trying to install the get_cli package for flutter.

install command is pub global activate get_cli, however pub is not a global variable on my windows 10 machine.

i think i need to add variables to the system environment variables, but i'm not sure what paths and how to call them.

this answer works for unix, so im looking for something similar for windows.

anyone got an idea?

edit: error: 'pub' is not recognized as an internal or external command, operable program or batch file.


Solution

  • If you have Flutter installed in C:\src\flutter, you can add the following path variable: C:\src\flutter\bin\cache\dart-sdk\bin. (If Flutter is installed in a different location, simply adjust the beginning of the path accordingly.) After that, restart your command line tool or IDE.

    You can also add the flutter prefix before pub, like this:
    flutter pub global activate get_cli

    According to flutter -h:
    flutter pub passes the remaining arguments to Dart's pub tool.