19

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.

narrei
  • 516
  • 2
  • 6
  • 19

4 Answers4

47

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

Owczar
  • 2,335
  • 1
  • 17
  • 24
  • 3
    thank you very much. i already have added the flutter before, so all i needed to do was add flutter before the pub keyword. – narrei Oct 03 '20 at 18:18
  • there is name and value column, value is the path, does name matter or is it only for me so i know in the future when i forget? – narrei Oct 03 '20 at 18:59
  • 1
    Name is used by an app or system and is pre-defined. For example: [Widows environment variables](https://en.wikipedia.org/wiki/Environment_variable#Windows), [Dart environment variables](https://dart.dev/tools/pub/environment-variables) or [Android Studio environment variables](https://developer.android.com/studio/command-line/variables#envar). You should define Dart path in `User variables` -> `Path` (there you can set only paths). Do not confuse it with `System variables`. – Owczar Oct 03 '20 at 19:20
8

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

enjoy

David Baruka
  • 121
  • 1
  • 3
1

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

Hasan El-Hefnawy
  • 1,249
  • 1
  • 14
  • 20
-1

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 .

Jeslin Jacob
  • 570
  • 6
  • 8