leoafarias / fvm

Flutter Version Management: A simple CLI to manage Flutter SDK versions.
https://fvm.app
MIT License
4.7k stars 230 forks source link

[BUG]https://github.com/leoafarias/fvm/issues/638 report in fvm version:3.1.3 #707

Closed dujj closed 2 weeks ago

dujj commented 7 months ago

Before creating a bug report please make check the following

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to terminal..
  2. Run fvm use stable...
  3. Check...
  4. See error

Expected behavior A clear and concise description of what you expected to happen.

Logs Please provide the verbose logs by running --verbose after the command.

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

dujj commented 7 months ago
企业微信截图_26fe03ca-eee8-4e00-b380-b98c4c5056a7
leoafarias commented 6 months ago

Can you tell me the version of fvm

also run the command with the --verbose flag as it will show which directories are looking at.

dujj commented 6 months ago

3.1.3

leoafarias commented 6 months ago

@dujj Can you run with the --verbose flag so we can see the directories that is lookin into for pubspec?

dujj commented 6 months ago
企业微信截图_2c38bb03-f2e3-4bc7-8f2f-5a10ca8344db
leoafarias commented 6 months ago

@dujj Based on those logs, it seems there is an fvm config in that /work directory. So it's looking for the config file instead of the pubspec because of nested directories. Therefore, the message indicates that there is no pubspec found in the same directory where the project config is located.

dujj commented 6 months ago
  1. flutter create test
  2. cd test
  3. ls -a
  4. fvm use 3.19.6 --verbose `Argument information: Top level options:
    • verbose: true

Command: use

Searching for project in /Users/k/Documents/work/123/test Searching for project in /Users/k/Documents/work/123 Searching for project in /Users/k/Documents/work Found project config in /Users/k/Documents/work

No pubspec.yaml detected in this directory ✔ Would you like to continue? · yes

Updating project config Project name: work Project path: /Users/k/Documents/work

Checking .gitignore Update gitignore: true [WARN] Project is not a git repository. But will set .gitignore as IDEs may use it,to determine what to index and display on searches, .fvm/ already exists in .gitignore Resolving dependencies... Starting to update environment variables...

Running: /Users/k/fvm/versions/3.19.6/bin/flutter

✓ Dependencies resolved. (0ms) Resolving dependencies... meta 1.11.0 (1.12.0 available) test_api 0.6.1 (0.7.0 available) vm_service 13.0.0 (14.0.0 available) Got dependencies! 3 packages have newer versions incompatible with dependency constraints. Try flutter pub outdated for more information.

✓ Project now uses Flutter SDK : SDK Version : 3.19.6`

dujj commented 6 months ago

see : test is new project created by flutter Searching for project in /Users/k/Documents/work/123/test Searching for project in /Users/k/Documents/work/123 Searching for project in /Users/k/Documents/work Found project config in /Users/k/Documents/work

but: Searching for project logs, show: project config in work

right: Searching for project in /Users/k/Documents/work/123/test test is project

project find failed, so all wrong

dujj commented 6 months ago

I clean work,result: fvm use 3.19.6 --verbose

Argument information: Top level options:

Command: use

Searching for project in /Users/k/Documents/work/123/test Searching for project in /Users/k/Documents/work/123 Searching for project in /Users/k/Documents/work Searching for project in /Users/k/Documents Searching for project in /Users/k Searching for project in /Users Searching for project in / No project found in /Users/k/Documents/work/123/test

Updating project config Project name: test Project path: /Users/k/Documents/work/123/test

Checking .gitignore Update gitignore: true [WARN] Project is not a git repository. But will set .gitignore as IDEs may use it,to determine what to index and display on searches, You should add the fvm version directory ".fvm/" to .gitignore. ✔ Would you like to do that now? · yes
✓ Added .fvm/ to .gitignore

✓ Project now uses Flutter SDK : SDK Version : 3.19.6

This operation was as expected

But I still don’t understand why the search is not in the current directory to determine whether there is a problem with the conditions of a project, and why it is searched recursively upwards.

leoafarias commented 2 weeks ago

@dujj I will close this issue since it seems to be working. The recursion supports workspaces and/or monorepos, so you have the same version configured for multiple projects.