Skip to content

Flutter's local .pub-cache doesn't interact well with separate Dart install #37481

Closed

Description

@vsmenon

When a developer has separate installs of the Flutter and Dart SDKs, our tools are confused by Flutter's separate .pub-cache. This can lead to inscrutable errors. E.g.,:

#36933

Activity

  1. gspencergoog commented on Aug 2, 2019

    @gspencergoog
    Contributor

    Just to explain why why we have the cache:
    The pre-populated cache serves several purposes:

    1. People can just run flutter run and it will work right out of the box, with no extra downloading.
    2. People who download flutter when they have a fast connection, but try to use it the first time without a connection, or with a slow one, aren't disappointed (the airport problem), and
    3. People in other parts of the world without access to the pub server (i.e. China) can download our package and use it instead of being stopped by not being able to access the server.

    Ideally, we'd do some magic behind the scenes to merge that cache with the user's cache on first run or something. Even more ideally, we'd have a "real" installer, and be able to just install stuff into the user's cache in the first place.

    Another option would be to have pub look in multiple caches (via some sort of PUB_CACHE_PATH var or something), and then we could set it in the flutter tool to look in the user's cache first and the pre-populated one second.

  2. added
    toolAffects the "flutter" command-line tool. See also t: labels.
    on Aug 2, 2019
  3. Hixie commented on Aug 2, 2019

    @Hixie
    Contributor

    How does pub determine which cache to use?

  4. added this to the milestone on Aug 2, 2019
  5. gspencergoog commented on Aug 2, 2019

    @gspencergoog
    Contributor

    Via the PUB_CACHE environment variable, and defaults to ~/.pub-cache. We set PUB_CACHE inside of the flutter tool if we notice that the flutter directory has a .pub-cache.

    The workaround for this issue is to have people delete the flutter directory's .pub-cache and just use theirs.

  6. added
    P2Important issues not at the top of the work list
    on May 29, 2020
  7. removed this from the milestone on Aug 17, 2020
  8. github-actions commented on Mar 27, 2023

    @github-actions

    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.

  9. locked as resolved and limited conversation to collaborators on Mar 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: first hourThe first hour of using FluttertoolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions