Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] In "fvm use x.y.z" command, it uses home directory instead of current cmd project directory #769

Open
4 tasks done
bsudhanva opened this issue Aug 27, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@bsudhanva
Copy link

bsudhanva commented Aug 27, 2024

Before creating a bug report please make check the following

  • You have read our FAQ
  • If you have used flutter. Please install correctly, run pub cache repair. Close the terminal and try again.
  • If you are on Windows. Make sure you are running the terminal as administrator or with developer permissions.
  • Run fvm doctor if possible and add the output to the issue.

Describe the bug

A clear and concise description of what the bug is.
when i use "fvm use x.y.z" commands it considers my root/home directory and creates a .fvmrc in it, instead of my project directory

To Reproduce
Steps to reproduce the behavior:

  1. Go to terminal.. cd /d pat/to/project_ directory or within vscode terminal
  2. Run fvm use stable...
  3. it gives following output
PS C:\Users\myusername\projects\learningdart> fvm use stable

Using .fvmrc in C:\Users\myusername

If this is incorrect either use the --force flag or remove the .fvmrc and the .fvm directory.

Skipping "pub get" because no pubspec.yaml found.

✓ Project now uses Flutter SDK : Channel: Stable

incase you use --force

fvm use stable --force
[WARN] Not checking for version mismatch as --force flag is set.
Skipping "pub get" because no pubspec.yaml found.

✓ Project now uses Flutter SDK : Channel: Stable

Expected behavior
I expect it to consider my current directory as my project directory instead of my home directory

Logs

C:\Users\MyUserName\projects\learningdart> fvm doctor
FVM Doctor:
------------------------------------------------------------------------------------------------------------------------
Project:
│ Project                     │ MyUsername                         │
├─────────────────────────────┼──────────────────────────────────────┤
│ Directory                   │ C:\Users\Myusername         │
├─────────────────────────────┼──────────────────────────────────────┤
│ Active Flavor               │ None                                 │
├─────────────────────────────┼──────────────────────────────────────┤
│ Is Flutter Project          │ No  

Desktop (please complete the following information):

  • OS: Win 11 x64
  • FVM Version 3.1.7

Workaround
delete any ".fvm folder" and ".fvmrc file" as suggested by fvm

for example.
C:\ A\B\C\D\MyProjectFolder

even though command prompt is at MyProject folder directory, it'll first check the highest directory and then to the lower one i.e A then B then C and then D and finally the actual project.
So check these and delete the mentioned files and folder

@bsudhanva bsudhanva added the bug Something isn't working label Aug 27, 2024
@leoafarias
Copy link
Owner

@bsudhanva We cannot assume the current directory as the project directory due to the monorepo setup. However, maybe we can do some printing or logging to let people know which directory it is using. Also, you can force the creation of a .fvmrc in that directory by using the --force flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants