I am trying to build an application using the Flutter SDK, but on running flutter packages get in the application's directory, what I get is
Running "flutter packages get" in startup_namer...
Got socket error trying to find package cupertino_icons at https://pub.dartlang.org.
pub get failed (69) -- attempting retry 1 in 1 second...
This was initially reported on Flutter's issues page here, but I was directed to post the issue here.
I am not behind any proxy connection, and am located in Nigeria. A fellow Nigerian also complained about this on stackoverflow.
flutter doctor -v prints
[√] Flutter (Channel beta, v0.8.2, on Microsoft Windows [Version 10.0.17134.286], locale en-US)
• Flutter version 0.8.2 at C:\Flutter\flutter
• Framework revision 5ab9e70727 (4 weeks ago), 2018-09-07 12:33:05 -0700
• Engine revision 58a1894a1c
• Dart version 2.1.0-dev.3.1.flutter-760a9690c2
[!] Android toolchain - develop for Android devices (Android SDK 28.0.0)
• Android SDK at C:\Users\AUNTYHANNAH\AppData\Local\Android\Sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.0
• ANDROID_HOME = C:\Users\AUNTYHANNAH\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
X Android license status unknown.
[√] Android Studio (version 3.1)
• Android Studio at C:\Program Files\Android\Android Studio
X Flutter plugin not installed; this adds Flutter specific functionality.
X Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
[√] VS Code (version 1.27.2)
• VS Code at C:\Users\AUNTYHANNAH\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 2.18.0
[√] VS Code, 64-bit edition (version 1.17.1)
• VS Code at C:\Program Files\Microsoft VS Code
• Flutter extension version 2.18.0
[!] Connected devices
! No devices available
! Doctor found issues in 2 categories.
Edited by member of this repository: This is not a solution, hence, I have deleted it as it was confusing people -- see previous version of this common on github, if you really want to know what it said. Notice that https://dartlang-pub-dev.appspot.com/ is a staging site with outdated data, do not use it!
Hello Samuel, has your issue been resolved? Mine isn't working either.
@samueladekunle I'm also in Nigeria and i faced this same issue. I then resolved to using a VPN, and it worked for me. I think we in Nigeria and some other parts of the world have this issue with some packages.
Is the https://pub.dartlang.org/ site reachable in a browser?
cc @mit-mit
@HemlockBane I had to alternate in between a public Wi-Fi and a VPN service for some weeks. But rather strangely, after switching from Windows to Linux, I have not experienced the same issue on my home network.
I'm facing the same issue, @natebosch https://pub.dartlang.org/ is reachable in my browser.
Could it be coz of Corporate laptop I'm using having restrictions? I'm in india btw
Here in Brazil the website https://pub.dartlang.org/ that flutter uses to get the packages with flutter packages get isn't reachable. I tried using TunnelBear VPN connecting to a USA network and it all worked fine.
@leodavinci1, could you check if this is ipv6 related (or DNS related, try using 8.8.8.8)
@jonasfj Tested with 8.8.8.8 DNS config and the website https://pub.dartlang.org/ worked perfectly. When I removed that DNS config, website became unreachable again.
Hi , i also got this problem in China , do you have a solve way for me ? thanks .
@chenxiaoyanemile, you can use the Chinese community mirror.
@jonasfj Hi , thank you for your answer . but i have try it , it doesn't work for me .
fixed it in China with this method.
Got the same issue recently while trying to setup flutter. Turn's out I did not set-up the proxy correctly.
If you are also behind a proxy then please make sure you strictly follow the format from https://dart.dev/tools/pub/troubleshoot#pub-get-fails-from-behind-a-corporate-firewall
If you are on Windows and you run the flutter/pub command from PowerShell, the usual recommendation set https_proxy=proxy.yourproxy.com:8080 will not work. The correct ways is:
$Env:https_proxy="proxy.yourproxy.com:8080"
@fioan89,
Uh, nice trick with PowerShell, please consider contributing to the documentation page you referenced :)
@jonasfj got it. Thanks for the tip.
Running '$env:https_proxy='proxy.yourproxy.com:8080' on Powershell gives and error =>_The filename, directory name, or volume label syntax is incorrect._
Any help?
$
I also tried running without the $, like 'env:https_proxy=proxy.yourproxy.com:8080'. I am not sure if I am missing something.
:( weird, according to this Microsoft page it should work.
What version of PowerShell do you have?
Are you using some kind of special characters in the proxy name? Anything outside a-z A-Z or 0-9?
Running '$env:https_proxy='proxy.yourproxy.com:8080' on Powershell gives and error =>_The filename, directory name, or volume label syntax is incorrect._
Any help?
Are you sure you are running this with PowerShell and not Command Prompt? :) I just ran the expression in Windows Command Prompt and it returns the exact same error as you mentioned.
Had thesame issue from Nigeria. I think the issue maybe from my network provider. I fixed it following by declaring PUB_HOSTED_URL as a system environment variable and give it the value https://pub.dev/
You may need to restart your command prompt window for the changes to take effect.
don't know if it helps
please do not just copy blindly above solution given by @samueladekunle , you may need to create PUB_HOSTED_URI, but probably link that you need to enter is dependent on your location, for ex- for me it was https://pub.dev/ instead
Try to see if you can reach https://pub.dev/ in your browser
If it is accessible, declare PUB_HOSTED_URL as a system environment variable and give it the value https://pub.dev./
Then exit and reopen your cmd window and try again.
Edit:
Changed ' https://dartlang-pub-dev.appspot.com/' to ' https://pub.dev/' based on @jonasfj correction
Do not use https://dartlang-pub-dev.appspot.com/.
This is a staging site used for development and stuff.. data is outdated and often incorrect.
Hello, everyone, I am facing an issue like below when run flutter pub get.
"Running "flutter pub get" in flutter_application...
(This is taking an unexpectedly long time.) "
I want to fix this, could you explain how to fix this issue?
Most helpful comment
Do not use
https://dartlang-pub-dev.appspot.com/.This is a staging site used for development and stuff.. data is outdated and often incorrect.