leoafarias/fvm

Add a command how to remove global version

tenhobi opened this issue · 6 comments

There is a command fvm global to configure one version as global, but there is no legit way how to disable global version completely. One can only remove ~/fvm/default.

So something like fvm global --disable or so would be nice.

@tenhobi The only way to disable the global would be to change your PATH to not point to fvm/default I think this might cause an error and the user won't know why.

Any suggestions?

Well as I user I should be able to somehow disable the global Flutter via FVM version. For example so I am sure I use the local Flutter version everywhere correctly. For example, Melos now probably does not work with local FVM (their sdkPath option) and testing if it works with global Flutter was one way how to make that work temporarily.

Disabling the global FVM is also possible by removing fvm/default, even tho this stays in PATH (and if it does have something that does not exists, it's basically the same as not being present, no) -- at least thats what I did locally to disable global.

@tenhobi I'm not entirely sure I understand. We could create a command to disable global, but if you have the path configured anywhere else, it will just result in an error. However, in the case of vscode, it checks different levels of configuration, so it might handle the check if the path does not exist.

Is the workflow you are checking is running flutter command on a new terminal outside of vscode?

The issue I am talking about is with melos right now invertase/melos#616. My colleague installed fvm for the first time and had issues, I wanted to test it on my machine and therefore I wanted to disable fvm global just to discover I cannot do that using the CLI.

Of course I can disable it manually, if I have the knowledge about it being in PATH etc. and if I find the file where FVM put it to PATH etc.

But maybe you are right, its really hard to remove PATH add and make it less error prone. Maybe adding a note to docs would be enough?

Thanks for linking the issue; I will take a look. There is a command fvm exec https://fvm.app/documentation/guides/basic-commands#exec; this injects the fvm SDK into the flutter path for that command. See if that resolves, at least temporarily.

@tenhobi, one more thing to help me with. Are you using the latest version of FVM? When you run the use command, it should complain about being unable to resolve Melos if it's incompatible with the Dart SDK version, like the error below.

Can't load Kernel binary: Invalid kernel binary format version.
melos 4.1.0 doesn't support Dart 2.14.3.