Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flutter version management. error : -bash: fvm: command not found

I am trying to install the flutter version manager to switch the flutter version among the different flutter projects. I use the command to install the fvm - pub global activate fvm

but when I run the command on the terminal - fvm help There is an error -bash: fvm: command not found

How to fix it ?

like image 714
MANISH PATHAK Avatar asked Aug 18 '20 12:08

MANISH PATHAK


People also ask

How do you get rid of Fvm flutters?

How to uninstall FVM. Run command fvm list this will output the directory used for Flutter cache. Delete that directory. If you installed using pub run dart pub global deactivate fvm , if you used a standalone installation please follow its instructions.

How do I upgrade Fvm flutter?

In the Android Studio menu open Languages & Frameworks -> Flutter or search for Flutter and change Flutter SDK path. Apply the changes. You now can Run and Debug with the selected versions of Flutter. Restart Android Studio to see the new settings applied.


4 Answers

Your .pub-cache binaries are not yet added to your PATH variable, used by your terminal. Add path with the following command:

export PATH="$PATH:$HOME/.pub-cache/bin"

This is the location where fvm is installed. So by exporting this path to your PATH variable you should be able to get fvm working from anywhere in your terminal.

like image 149
Koen Van Looveren Avatar answered Oct 07 '22 15:10

Koen Van Looveren


If you installed fvm using pub and you already have it in your path but you are still getting the error, follow these steps:

  1. run dart pub cache repair // You may get an error: Failed to precompile fvm:main:. Just ignore that for now.
  2. run dart pub global activate fvm
like image 23
mskolnick Avatar answered Oct 07 '22 13:10

mskolnick


You must add the path to the fvm executable to the $PATH environment variable. After running "pub global activate fvm" you should have seen a warning with instructions on how to fix it. You can watch this: https://youtu.be/R6vKde1vIGQ That will get you up and running.

like image 3
Sander Roest Avatar answered Oct 07 '22 15:10

Sander Roest


you can do a

flutter clean

then when its done, run

dart pub global activate fvm

when it's done it should work now, close the current bash terminal and open a new one

like image 2
IBRAHIM ALI MUSAH Avatar answered Oct 07 '22 14:10

IBRAHIM ALI MUSAH