flutter / flutter

Flutter makes it easy and fast to build beautiful apps for mobile and beyond
https://flutter.dev
BSD 3-Clause "New" or "Revised" License
165.45k stars 27.31k forks source link

【ERROR】Unable to pub upgrade flutter tool. Retrying in five seconds... #13349

Closed 2yanyi closed 5 years ago

2yanyi commented 6 years ago

ubuntu 17.04

环境搭建遇到错误

git clone -b alpha https://github.com/flutter/flutter.git
evanyan@ps:~$ flutter doctor
Building flutter tool...
The setter 'readEventsEnabled=' was called on null.
Receiver: null
Tried calling: readEventsEnabled=false
package:pub/src/source/hosted.dart 338                    BoundHostedSource._throwFriendlyError
package:pub/src/source/hosted.dart 140                    BoundHostedSource.doGetVersions
===== asynchronous gap ===========================
package:pub/src/source.dart 165                           BoundSource.getVersions
package:pub/src/solver/version_solver.dart 231            SolverCache.getVersions.<fn>
dart:async                                                runZoned
package:pub/src/http.dart 228                             withDependencyType
package:pub/src/solver/version_solver.dart 230            SolverCache.getVersions
===== asynchronous gap ===========================
package:pub/src/solver/unselected_package_queue.dart 121  UnselectedPackageQueue._getNumVersions
===== asynchronous gap ===========================
package:pub/src/solver/unselected_package_queue.dart 50   UnselectedPackageQueue.add
===== asynchronous gap ===========================
package:pub/src/solver/version_selection.dart 68          VersionSelection.select.<fn>
===== asynchronous gap ===========================
dart:async                                                _completeOnAsyncReturn
package:pub/src/solver/version_selection.dart 70          VersionSelection.select.<fn>
dart:async                                                _completeOnAsyncReturn
package:pub/src/solver/unselected_package_queue.dart 54   UnselectedPackageQueue.add
dart:async                                                _completeOnAsyncReturn
package:pub/src/solver/unselected_package_queue.dart 128  UnselectedPackageQueue._getNumVersions
dart:async                                                _Completer.completeError
package:pub/src/solver/version_solver.dart 254            SolverCache.getVersions
dart:async                                                _Completer.completeError
package:pub/src/source/hosted.dart 153                    BoundHostedSource.doGetVersions
dart:async                                                _Completer.completeError
package:http/src/base_client.dart 172                     BaseClient._sendUnstreamed
dart:async                                                _Completer.completeError
package:http_throttle/http_throttle.dart 51               ThrottleClient.send
dart:async                                                _Completer.completeError
package:pub/src/http.dart 127                             _PubHttpClient.send
dart:async                                                _Completer.completeError
package:http/src/io_client.dart 66                        IOClient.send
This is an unexpected error. Please run

    pub --trace upgrade --verbosity=error --no-packages-dir

and include the logs in an issue on https://github.com/dart-lang/pub/issues/new
Error: Unable to pub upgrade flutter tool. Retrying in five seconds...
eseidelGoogle commented 6 years ago

Presumably this is an access error to pub.dartlang.org which is causing a cascading failure? Which means there are several things wrong. @mit-mit

JavenLu commented 6 years ago

i have a problem,please help!

junludeMBP:~ Javen$ flutter doctor Building flutter tool... Got socket error trying to find package coverage at https://pub.dartlang.org. Error: Unable to pub upgrade flutter tool. Retrying in five seconds... Connection failed (OS Error: No route to host, errno = 65), address = storage.googleapis.com, port = 443 Error: Unable to pub upgrade flutter tool. Retrying in five seconds...

@eseidelGoogle thank you very much

eseidelGoogle commented 6 years ago

If you're in China, please try https://github.com/flutter/flutter/wiki/Using-Flutter-in-China and let us know if that doesn't work.

JavenLu commented 6 years ago

Thanks! it works! @eseidelGoogle

Hixie commented 6 years ago

These are all probably dupes of each other: https://github.com/flutter/flutter/issues/12301 https://github.com/flutter/flutter/issues/12702 https://github.com/flutter/flutter/issues/13222 https://github.com/flutter/flutter/issues/13349

kendeng9898 commented 6 years ago

Check http_proxy or system wide proxy have setting. remove the proxy setting. My Ubuntu 16.04, got this error. After remove the proxy setting everything go well.

linguowu commented 6 years ago

still get the error when i export PUB_HOSTED_URL=https://pub.flutter-io.cn export FLUTTER_STORAGE_BASE_URL=https://storage.flutter-io.cn then i run the example of hello_world Running "flutter packages get" in hello_world...

ERR : Connection failed (OS Error: No route to host, errno = 65), address = storage.googleapis.com, port = 443

that will make me give up .......

InMatrix commented 6 years ago

@linguowu Can you run the default app created by flutter create?

linguowu commented 6 years ago

@InMatrix when i run "flutter create myapp" it shows below:

Running "flutter packages get" in myapp...
Got socket error trying to find package cupertino_icons at https://pub.dartlang.org.

InMatrix commented 6 years ago

@linguowu It looks like the environmental variables were not working. Can you provide the following information for diagnostic purposes:

Also, did you use the mirror to install Flutter?

Thank you for your patience.

linguowu commented 6 years ago

@InMatrix how to get the mirror to install Flutter?

below is the output for diagnostic: `country5deMacBook-Pro-2:~ country5$ echo $PUB_HOSTED_URL

country5deMacBook-Pro-2:~ country5$ echo $FLUTTER_STORAGE_BASE_URL

country5deMacBook-Pro-2:~ country5$ ls ~/.pub-cache/hosted pub.dartlang.org pub.flutter-io.cn

country5deMacBook-Pro-2:~ country5$ flutter doctor -v
[  +14 ms] [/Users/country5/flutter/] git rev-parse --abbrev-ref --symbolic @{u}
[  +28 ms] Exit code 0 from: git rev-parse --abbrev-ref --symbolic @{u}
[        ] origin/alpha
[        ] [/Users/country5/flutter/] git rev-parse --abbrev-ref HEAD
[   +8 ms] Exit code 0 from: git rev-parse --abbrev-ref HEAD
[        ] alpha
[        ] [/Users/country5/flutter/] git ls-remote --get-url origin
[   +8 ms] Exit code 0 from: git ls-remote --get-url origin
[        ] https://github.com/flutter/flutter.git
[        ] [/Users/country5/flutter/] git log -n 1 --pretty=format:%H
[   +6 ms] Exit code 0 from: git log -n 1 --pretty=format:%H
[        ] 2e449f06f0a3be076e336ad6b30b0e9ec99dbdfe
[        ] [/Users/country5/flutter/] git log -n 1 --pretty=format:%ar
[   +6 ms] Exit code 0 from: git log -n 1 --pretty=format:%ar
[        ] 9 days ago
[        ] [/Users/country5/flutter/] git describe --match v*.*.* --first-parent --long --tags
[   +7 ms] Exit code 0 from: git describe --match v*.*.* --first-parent --long --tags
[        ] v0.0.21-0-g2e449f0
[ +135 ms] /usr/bin/defaults read /Applications/Android Studio.app/Contents/Info CFBundleShortVersionString
[  +61 ms] Exit code 0 from: /usr/bin/defaults read /Applications/Android Studio.app/Contents/Info CFBundleShortVersionString
[        ] 3.0
[ +129 ms] [✓] Flutter (on Mac OS X 10.12 16A323, locale zh-Hans-CN, channel alpha)
[        ]     • Flutter version 0.0.21 at /Users/country5/flutter
[        ]     • Framework revision 2e449f06f0 (9 days ago), 2018-01-29 14:26:51 -0800
[        ]     • Engine revision 6921873c71
[        ]     • Tools Dart version 2.0.0-dev.16.0
[        ]     • Engine Dart version 2.0.0-edge.da1f52592ef73fe3afa485385cb995b9aec0181a
[   +6 ms] /usr/bin/defaults read /Applications/Android Studio.app/Contents/Info CFBundleShortVersionString
[  +59 ms] Exit code 0 from: /usr/bin/defaults read /Applications/Android Studio.app/Contents/Info CFBundleShortVersionString
[        ] 3.0
[  +64 ms] java -version
[  +63 ms] [✓] Android toolchain - develop for Android devices (Android SDK 26.0.2)
[        ]     • Android SDK at /Users/country5/Development/android-sdk-macosx
[        ]     • Android NDK at /Users/country5/Development/android-sdk-macosx/ndk-bundle
[        ]     • Platform android-26, build-tools 26.0.2
[        ]     • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
[        ]     • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)
[  +99 ms] DevToolsSecurity -status
[  +31 ms] Developer mode is currently enabled.
[        ] python -c import six
[  +35 ms] idevice_id -h
[   +6 ms] idevice_id -h
[   +4 ms] idevice_id -l
[  +14 ms] ideviceinstaller -h
[   +6 ms] ios-deploy --version
[  +11 ms] ios-deploy --version
[   +9 ms] 1.9.2
[        ] ios-deploy --version
[   +8 ms] ios-deploy --version
[  +10 ms] 1.9.2
[   +1 ms] pod --version
[ +276 ms] pod --version
[ +276 ms] 1.3.1
[   +1 ms] pod --version
[ +267 ms] 1.3.1
[        ] [-] iOS toolchain - develop for iOS devices (Xcode 8.0)
[        ]     • Xcode at /Applications/Xcode.app/Contents/Developer
[        ]     • Xcode 8.0, Build version 8A218a
[        ]     ✗ Flutter requires a minimum Xcode version of 9.0.0.
                 Download the latest version or update via the Mac App Store.
[        ]     • ios-deploy 1.9.2
[        ]     • CocoaPods version 1.3.1
[   +1 ms] [✓] Android Studio (version 3.0)
[        ]     • Android Studio at /Applications/Android Studio.app/Contents
[        ]     • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-915-b08)
[  +21 ms] /Users/country5/Development/android-sdk-macosx/platform-tools/adb devices -l
[  +13 ms] Exit code 0 from: /Users/country5/Development/android-sdk-macosx/platform-tools/adb devices -l
[        ] List of devices attached
           ENU7N15A30000390       device usb:337641472X product:angler model:Nexus_6P device:angler transport_id:2
[   +7 ms] idevice_id -h
[  +18 ms] /Users/country5/Development/android-sdk-macosx/platform-tools/adb -s ENU7N15A30000390 shell getprop
[  +64 ms] ro.hardware = angler
[        ] ro.build.characteristics = nosdcard
[   +2 ms] [✓] Connected devices
[        ]     • Nexus 6P • ENU7N15A30000390 • android-arm • Android 8.1.0 (API 27)
[  +14 ms] "flutter doctor" took 1,664ms.
[ +100 ms] ensureAnalyticsSent: 98ms
[   +2 ms] exiting with code 0`
mit-mit commented 6 years ago

@linguowu given the output of the ECHO commands you have is empty it looks like those variable were not correctly exported/set. You need to make sure they are set before running the flutter command. See https://github.com/flutter/flutter/wiki/Using-Flutter-in-China for details.

InMatrix commented 6 years ago

@linguowu In addition to what @mit-mit said, you can persist these environment variables by adding these export commands to $HOME/.bash_profile and then source $HOME/.bash_profile.

hphpwj commented 6 years ago

D:\flutter\flutter>flutter doctor Updating flutter tool... Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds...

Waiting for 0 seconds, press CTRL+C to quit ... Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds...

Waiting for 3 seconds, press CTRL+C to quit ... Terminate batch job (Y/N)? y

and the environment variables is added: D:\flutter\flutter>echo %FLUTTER_STORAGE_BASE_URL% https://storage.flutter-io.cn

D:\flutter\flutter>echo %PUB_HOSTED_URL% https://pub.flutter-io.cn

a1265137718 commented 6 years ago
  1. checkout fluter by this way : https://github.com/flutter/flutter/wiki/Using-Flutter-in-China 2 .then try to excute : C:\flutterdev\flutter\bin\flutter.bat i sovled my problem
zoechi commented 5 years ago

Duplicate of #12301

tarisham commented 5 years ago

hi go to the bios and change vm (Virtual machine) from disable to enable. you want to run emulator so its Necessary.

github-actions[bot] commented 3 years ago

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.