flutter fvm error when using `use` command to change flutter version

Viewed 2931

I'm trying to use flutter fvm version management but I'm getting this error when I try to use new version. Will that config be created automatically? And how to enable permission?

D:\dev_projects\myapp>fvm list
Cache Directory:  C:\Users\user\fvm\versions

2.2.3
1.22.5 (active)

D:\dev_projects\myapp>fvm use 2.2.3 --verbose
[     0.073s] FileSystemException: Cannot open file, path = 'C:\Users\user\fvm\.settings' (OS Error: The system cannot find the file specified., errno = 2)
[     0.082s] FileSystemException: Cannot open file, path = 'C:\Users\user\fvm\.settings' (OS Error: The system cannot find the file specified., errno = 2)
[     0.082s] FileSystemException: Cannot open file, path = 'C:\Users\user\fvm\.settings' (OS Error: The system cannot find the file specified., errno = 2)
[     0.084s] Version: 2.2.3 - already installed.
[     0.090s] FileSystemException: Cannot open file, path = 'C:\Users\user\fvm\.settings' (OS Error: The system cannot find the file specified., errno = 2)
[     0.097s] FileSystemException: Cannot create link to target 'C:\Users\user\fvm\versions\1.22.5', path = 'D:\dev_projects\myapp\.fvm\flutter_sdk' (OS Error: A required privilege is not held by the client.
, errno = 1314)
[     0.098s] Usage Exception: Seems you don't have the required permissions on C:\Users\user\fvm On Windows FVM requires to run as an administrator or turn on developer mode: 

UPDATED:

D:\dev_projects\myapp>fvm doctor
    
    FVM Version: 2.2.3
    ___________________________________________________
    
    FVM config found:
    ___________________________________________________
    
    Project: myapp
    Directory: D:\dev_projects\myapp
    Version: 1.22.5
    Project Flavor: None selected
    ___________________________________________________
    
    Version is currently cached locally.
    
    Cache Path: C:\Users\user\fvm\versions\1.22.5
    Channel: false
    SDK Version: 1.22.5
    
    IDE Links
    VSCode: .fvm/flutter_sdk
    Android Studio: D:\dev_projects\myapp\.fvm\flutter_sdk
    
    
    Configured env paths:
    ___________________________________________________
    
    Flutter:
    D:\dev\flutter\bin\flutter.bat
    
    Dart:
    D:\dev\flutter\bin\dart.bat
    
    FVM_HOME:
    not set
3 Answers

For me it was because I copied a flutter project folder. I deleted the .fvm folder and did fvm use and it worked

I fixed this issue by turning on developer mode as the logs suggest. Go to your Settings, search for Developer settings and enable it from there. Now restart the IDE and try again.

I don't know if this is the correct way but I solved it by running vscode as administrator.

Related