Skip to content

Cannot flutter create when offline #96286

@mit-mit

Description

@mit-mit

Without flag

Repro steps

  1. Download a stable macOS build from the releases page: https://docs.flutter.dev/development/tools/sdk/releases

  2. Go offline (turn off wifi and anyther other network connection)

  3. Extract the downloaded zip (e.g. ~/tmp/flutter)

  4. Open a terminal, and run ~/tmp/flutter/bin/flutter create app1

Actual result

The command hangs:

mit-macbookpro4:tmp mit$ ./flutter/bin/flutter create app2
Running "flutter pub get" in flutter_tools...                          ⢿

If you run it with verbose, you can see it's failing trying to get to pub:
https://gist.github.com/mit-mit/17d8f6c21f8970fb6b9dba9e0f24c4cb

Expected result

The command doesn't hang. We should probably detect that we're offline and pass the --offline flag? Looks like that might be tracked in #15717

With flag

Repro steps

  1. Download a stable macOS build from the releases page: https://docs.flutter.dev/development/tools/sdk/releases

  2. Go offline (turn off wifi and anyther other network connection)

  3. Extract the downloaded zip (e.g. ~/tmp/flutter)

  4. Open a terminal, and run ~/tmp/flutter/bin/flutter create --offline app1

Actual result

The command fails trying to download some pub packages (full log file):

mit-macbookpro4:tmp mit$ ./flutter/bin/flutter --verbose create --offline foobar
...
[ +105 ms] MSG : Resolving dependencies...
[  +76 ms] SLVR: fact: flutter_tools is 0.0.0
...
[ +175 ms] MSG : Resolving dependencies...
...
[        ] SLVR: fact: flutter_tools depends on test 1.17.12
...
[  +13 ms] IO  : Get versions from https://pub.dartlang.org/api/packages/test.
[  +18 ms] IO  : HTTP GET https://pub.dartlang.org/api/packages/test
[        ]     | Accept: application/vnd.pub.v2+json
[        ]     | X-Pub-OS: macos
[        ]     | X-Pub-Command: get
[        ]     | X-Pub-Session-ID: DDBCDF1B-745B-4417-B0A9-ABE58D1EF131
[        ]     | X-Pub-Environment: flutter_cli:get
[        ]     | user-agent: Dart pub 2.15.1
[  +91 ms] IO  : HTTP error:
[        ]     | SocketException: Failed host lookup: 'pub.dartlang.org' (OS Error: nodename nor servname provided, or not known, errno = 8)

Expected result

The command doesn't hang.

Are the dependencies of the flutter tool not expected to be pre-populated into the cache? It looks like it doesn't have test 1.17.2:

mit-macbookpro4:pub.dartlang.org mit$ pwd
/Users/mit/tmp/flutter/.pub-cache/hosted/pub.dartlang.org

mit-macbookpro4:pub.dartlang.org mit$ ls -l | grep test
drwx------@  7 mit  primarygroup  224 Dec 16 20:31 file_testing-3.0.0
drwx------@ 14 mit  primarygroup  448 Dec 16 20:31 test-1.17.12
drwx------@ 10 mit  primarygroup  320 Dec 16 20:31 test_api-0.4.3
drwx------@  8 mit  primarygroup  256 Dec 16 20:31 test_core-0.4.2

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listfound in release: 2.8Found to occur in 2.8has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-macBuilding on or for macOS specificallyr: fixedIssue is closed as already fixed in a newer versiontoolAffects 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