Pub is not recognized as internal or external command

Viewed 15306

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.

4 Answers

If you have Flutter in C:\src\flutter, you can add path variable: C:\src\flutter\bin\cache\dart-sdk\bin (if you have Flutter in another localization, just replace the beginning of the path analogically) and restart your command line tool (or IDE).

You can add flutter prefix before pub as well: flutter pub global activate get_cli - according to flutter -h:

flutter pub - pass the remaining arguments to Dart's "pub" tool

Use dart pub not pub only and it should resolve your problem

enjoy

use flutter pub and make sure the path variable is C:\flutter\bin supposing the Flutter folder is located at C:\flutter

make sure you set the environment variables correctly.After that don't forget to restart the computer. I struggled with this issue for a long time but after doing all these things a magic code worked for me . Which you guys can also try.

dart pub global activate get_cli then use flutter pub global activate get_cli

this should work .

Related