Flutter - Flutter Version Management (fvm) package not working in windows

39.7k Views Asked by At

I just added the the fvm package to switch the flutter channel from stable to master without downloading sdk components every time when switching flutter channels.

I have followed the step written in readme.md for switching the channel.

I have set the following path in my environment variables.

D:\Program_Files\FlutterSDK\SDK\flutter\bin;
D:\Program_Files\FlutterSDK\SDK\dart-sdk\bin;
C:\Users\User\AppData\Roaming\Pub\Cache\bin;

Now, i have opened my first project in which i want to use "flutter SDK's master channel". But, whenever i try to use the command "fvm use master". It's not working.

It is giving me an error like, 'fvm' is not recognized as an internal or external command,

So, can anyone suggest a solution?

Thanks.

8

There are 8 best solutions below

2
On

try :

pub global run fvm:main

pub global run fvm:main use VERSION

0
On

Hi adding in your path:

%LOCALAPPDATA%\Pub\Cache\bin

More info:

https://dart.dev/tools/pub/cmd/pub-global#running-a-script-from-your-path

1
On

In my case fvm commands did not work on Windows even tho I checked everything. It gave missing fvm.exe file and other errors. If you also stuck there you can use this way. Only way I managed to get it work is to use longer commands like these:

 flutter pub global run fvm:main list

Seems like all fvm commands:

  config     Set configuration for FVM
  flutter    Proxies Flutter Commands
  install    Installs Flutter SDK Version
  list       Lists installed Flutter SDK Version
  releases   Lists Flutter SDK releases.
  remove     Removes Flutter SDK Version
  use        Which Flutter SDK Version you would like to use
  version    Prints the currently-installed version of FVM

Works like this, you just need to add the fvm command to the ending of this - flutter pub global run fvm:main. So add any of them like this form:

flutter pub global run fvm:main releases
flutter pub global run fvm:main install 2.2.0
flutter pub global run fvm:main use 2.2.0
0
On

Just try:
dart pub global activate fvm

0
On

Just delete the .fvm hidden folder in the project and re-run

0
On

are you add "C:\flutter\bin\cache\dart-sdk\bin" to path? enter image description here

if you in windows you should run your text editor as administrator as following

enter image description here

0
On

In my case Error Message was

Usage Error: Flutter version null is not installed

To fix this:

  1. I have activated FVM by pub global activate fvm;
  2. Printed installed fvm list by fvm list, it should give result as the image below:

fvm list result image

  1. Selected which Flutter SDK version to use by running fvm use 1.22.0 (in my case 1.22.0, it may differ according to your desired version) command, It will download SDK if it is not installed yet;
  2. Now you can check is flutter running in your project by running flutter;

Also, you can check if the Flutter SDK version set by calling again fvm list. enter image description here

The tick means, that version is running in your project.

0
On

Run as administrator in the project folder and the error is solved. Example:

  • administrator cmd C:\Usersers\USURIO\Documents\Flutterproject> fvm use 3.10.0 project now uses Flutter [3.10.0].