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

Unable to download packages from https://pub.dartlang.org #1989

Closed
samueladekunle opened this issue Oct 2, 2018 · 31 comments
Closed

Unable to download packages from https://pub.dartlang.org #1989

samueladekunle opened this issue Oct 2, 2018 · 31 comments

Comments

@samueladekunle
Copy link

samueladekunle commented Oct 2, 2018

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.

Solution

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!

@HemlockBane
Copy link

Hello Samuel, has your issue been resolved? Mine isn't working either.

@a-oboh
Copy link

a-oboh commented Dec 23, 2018

@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.

@natebosch
Copy link
Member

Is the https://pub.dartlang.org/ site reachable in a browser?

cc @mit-mit

@samueladekunle
Copy link
Author

samueladekunle commented Dec 28, 2018

@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.

@far11ven
Copy link

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

@leodavinci1
Copy link

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.

@jonasfj
Copy link
Member

jonasfj commented Mar 25, 2019

@leodavinci1, could you check if this is ipv6 related (or DNS related, try using 8.8.8.8)

@leodavinci1
Copy link

leodavinci1 commented Mar 25, 2019

@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.

@chenxiaoyanemile
Copy link

Hi , i also got this problem in China , do you have a solve way for me ? thanks .

@jonasfj
Copy link
Member

jonasfj commented Jul 1, 2019

@chenxiaoyanemile, you can use the Chinese community mirror.

@chenxiaoyanemile
Copy link

@jonasfj Hi , thank you for your answer . but i have try it , it doesn't work for me .

@chenxiaoyanemile
Copy link

fixed it in China with this method.

https://www.jianshu.com/p/c524d4ffe605.

@fioan89
Copy link

fioan89 commented Sep 3, 2019

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"

@jonasfj
Copy link
Member

jonasfj commented Sep 3, 2019

@fioan89,
Uh, nice trick with PowerShell, please consider contributing to the documentation page you referenced :)

@fioan89
Copy link

fioan89 commented Sep 3, 2019

@jonasfj got it. Thanks for the tip.

@lvcster
Copy link

lvcster commented Sep 4, 2019

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?

@lvcster
Copy link

lvcster commented Sep 4, 2019

$

I also tried running without the $, like 'env:https_proxy=proxy.yourproxy.com:8080'. I am not sure if I am missing something.

@lvcster
Copy link

lvcster commented Sep 4, 2019

I found the problem and fixed it...
set https_proxy=proxy.yourproxy.com:8080 must be wrapped within single quotes like
set https_proxy='proxy.yourproxy.com:8080'. This is in Windows.

@fioan89
Copy link

fioan89 commented Sep 4, 2019

:( 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?

@fioan89
Copy link

fioan89 commented Sep 4, 2019

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.

@tejiriadjogbe
Copy link

tejiriadjogbe commented Sep 24, 2019

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

@vishnuagbly
Copy link

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

@Tarhex
Copy link

Tarhex commented May 16, 2020

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

@jonasfj
Copy link
Member

jonasfj commented May 16, 2020

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.

@yanaderevianko726
Copy link

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?

@henriquecostadev
Copy link

Hey everyone !

I was having this same problem executing the command in the VSCode terminal:

$ flutter pub get
Got socket error trying to find package sqflite at https://pub.dartlang.org.
pub get failed (server unavailable) -- attempting retry 1 in 1 second...
Got socket error trying to find package sqflite at https://pub.dartlang.org.
pub get failed (server unavailable) -- attempting retry 2 in 2 seconds...
Running "flutter pub get" in contacts_list...

And using the linux terminal I could execute the command with no problems:

$ flutter pub get
Running "flutter pub get" in contacts_list...                       6.4s

and I don't know why ¯_(ツ)_/¯

@Arvinth-Krishna
Copy link

Hey everyone !

I was having this same problem executing the command in the VSCode terminal:

$ flutter pub get
Got socket error trying to find package sqflite at https://pub.dartlang.org.
pub get failed (server unavailable) -- attempting retry 1 in 1 second...
Got socket error trying to find package sqflite at https://pub.dartlang.org.
pub get failed (server unavailable) -- attempting retry 2 in 2 seconds...
Running "flutter pub get" in contacts_list...

And using the linux terminal I could execute the command with no problems:

$ flutter pub get
Running "flutter pub get" in contacts_list...                       6.4s

and I don't know why ¯_(ツ)_/¯

is this problem solved?

@a-oboh
Copy link

a-oboh commented Aug 1, 2021 via email

@NduO
Copy link

NduO commented Aug 4, 2021

From Nigeria, I switched from AIRTEL network to MTN network and it connected to pub.dartlang.org and resolved. I am using WINDOWS

@pouyaSanjari
Copy link

hi
i can connect to pub.dev but can`t download any dependecy of it!
when i run pub upgrade it show upgrades but dont download!
any help?

@patrickubong
Copy link

patrickubong commented Feb 6, 2023

This a straight forward solution, just get a VPN and use US IP address and you will be fine. Using Free version of ProtonVPN with free US IP worked for me. Flutter Doctor and Pub Get issues resolved instantly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests