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

.dart_tool/package_config.json does not exist on Flutter 2.12.0-4.1.pre #100350

Closed
domesticmouse opened this issue Mar 18, 2022 · 10 comments
Closed
Labels
dependency: dart Dart team may need to help us found in release: 2.12 Found to occur in 2.12 r: fixed Issue is closed as already fixed in a newer version tool Affects the "flutter" command-line tool. See also t: labels.

Comments

@domesticmouse
Copy link
Contributor

domesticmouse commented Mar 18, 2022

Error: https://github.com/flutter/samples/runs/5595965164?check_suite_focus=true#step:5:72
Context: flutter/samples#1053

== Testing 'add_to_app/books/flutter_module_books' on Flutter's beta channel ==
~/work/samples/samples/add_to_app/books/flutter_module_books ~/work/samples/samples
Running "flutter pub get" in flutter_module_books...                4.7s
/opt/hostedtoolcache/flutter/2.12.0-4.1.pre-beta/x64/packages/flutter_tools/.dart_tool/package_config.json does not exist.Did you run this command from the same directory as your pubspec.yaml file?

Error: Process completed with exit code 1.

Flutter doctor output:

[✓] Flutter (Channel beta, 2.12.0-4.1.pre, on Ubuntu 20.04.4 LTS 5.11.0-1028-azure, locale C.UTF-8)
    • Flutter version 2.12.0-4.1.pre at /opt/hostedtoolcache/flutter/2.12.0-4.1.pre-beta/x64
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 680962aa75 (32 hours ago), 2022-03-16 13:[46](https://github.com/flutter/samples/runs/5595917505?check_suite_focus=true#step:5:46):03 -0700
    • Engine revision e9f57b5d0f
    • Dart version 2.17.0 (build 2.17.0-182.1.beta)
    • DevTools version 2.11.1

[!] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
    • Android SDK at /usr/local/lib/android/sdk
    • Platform android-32, build-tools 32.0.0
    • ANDROID_HOME = /usr/local/lib/android/sdk
    • ANDROID_SDK_ROOT = /usr/local/lib/android/sdk
    • Java binary at: /opt/hostedtoolcache/jdk/12.0.2/x64/bin/java
    • Java version OpenJDK Runtime Environment Zulu12.3+11-CA (build 12.0.2+3)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).

[✓] Connected device (1 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 98.0.[47](https://github.com/flutter/samples/runs/5595917505?check_suite_focus=true#step:5:47)[58](https://github.com/flutter/samples/runs/5595917505?check_suite_focus=true#step:5:58).102

[✓] HTTP Host Availability
    • All required HTTP hosts are available

! Doctor found issues in 2 categories.
@sigurdm
Copy link
Contributor

sigurdm commented Mar 18, 2022

Seems like the package_config.json does not load.

The error is thrown from here:

String message = '${file.path} does not exist.';

Could you try running with --verbose somehow?

@darshankawar darshankawar added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Mar 18, 2022
@domesticmouse
Copy link
Contributor Author

@sigurdm is the following helpful?

https://github.com/flutter/samples/runs/5599349696?check_suite_focus=true#step:5:69

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Mar 18, 2022
@darshankawar darshankawar added tool Affects the "flutter" command-line tool. See also t: labels. dependency: dart Dart team may need to help us found in release: 2.12 Found to occur in 2.12 and removed in triage Presently being triaged by the triage team labels Mar 18, 2022
@sigurdm
Copy link
Contributor

sigurdm commented Mar 18, 2022

It seems like the flutter_module_books/.dart_tool/package_config.json gets written:

[   +1 ms] IO  : Writing 8765 characters to text file .dart_tool/package_config.json.
[        ] FINE: Contents:
[        ]     | {
[        ]     |   "configVersion": 2,
[        ]     |   "packages": [
[        ]     |     {
......
[        ]     |     {
[        ]     |       "name": "flutter_module_books",
[        ]     |       "rootUri": "../",
[        ]     |       "packageUri": "lib/",
[        ]     |       "languageVersion": "2.7"
[        ]     |     }
[        ]     |   ],
[        ]     |   "generated": "2022-03-18T11:03:45.833890Z",
[        ]     |   "generator": "pub",
[        ]     |   "generatorVersion": "2.17.0-182.1.beta"
[        ]     | }

And then it tries to load the package_config of flutter_tools:

[  +79 ms] Running "flutter pub get" in flutter_module_books... (completed in 6.9s)
[  +86 ms] Invalid argument (file): File cannot be read: "file:///opt/hostedtoolcache/flutter/2.12.0-4.1.pre-beta/x64/packages/flutter_tools/.dart_tool/package_config.json"

The "File cannot be read" comes from:
https://github.com/flutter/flutter/blob/use_package_config_in_build_info/.pub_cache/hosted/pub.dartlang.org/package_config-2.0.2/lib/src/package_config_io.dart#L102

Loading the package_config.json of flutter_tools probably comes from:

fileSystem.path.join(_flutterRoot(), 'packages', 'flutter_tools', '.dart_tool', 'package_config.json'),

Still not sure what has changed here, or what is going wrong. I doubt it is a pub issue.

@domesticmouse
Copy link
Contributor Author

My concern is this code path is working fine with stable, and has been working pretty much unchanged for a year. We are either going to need to fix this, or publicise a work around.

/cc @RedBrogdon @kevmoo

@kevmoo
Copy link
Contributor

kevmoo commented Mar 18, 2022

CC @mit-mit – related to .packages changes?

@christopherfujino
Copy link
Member

@Jasguerrero can you take a look at this? This release does have your change, however, I'm still not exactly sure how we are reaching this.

Also note that this CI build is using https://github.com/subosito/flutter-action, which may be doing something funny with the pub-cache.

@christopherfujino
Copy link
Member

I suspect this is a regression caused by #97722

@christopherfujino christopherfujino changed the title Flutter 2.12.0-4.1.pre unexpected error .dart_tool/package_config.json does not exist on Flutter 2.12.0-4.1.pre Mar 21, 2022
@bichoalexis
Copy link

Hey there, Im not sure If you already discovered (because me English is not the best) but for anyone who directly download de arm64 flutter beta zip from flutter.dev, they gonna have the same issue, the current solution is clone the repository and then when you create your app, its gonna auto download the required tools. 🤓

@christopherfujino
Copy link
Member

This was fixed by 50f3e47

@darshankawar darshankawar added the r: fixed Issue is closed as already fixed in a newer version label May 26, 2022
@github-actions
Copy link

github-actions bot commented Jun 9, 2022

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
dependency: dart Dart team may need to help us found in release: 2.12 Found to occur in 2.12 r: fixed Issue is closed as already fixed in a newer version tool Affects the "flutter" command-line tool. See also t: labels.
Projects
None yet
Development

No branches or pull requests

6 participants