Got TLS error trying to find package ABC at https://pub.dartlang.org
Asked Answered
B

11

8

I am using Linux Ubuntu 18.04.1 LTS. I am creating a new Flutter project through git bash or terminal or from Visual Studio Code directly but gets an error which says:

Got TLS error trying to find package cupertino_icons at https://pub.dartlang.org

In Flutter Project's pubspec.yaml file I removed the line "cupertino_icons: ^0.1.2" in an attempt to resolve the issue but gets the same error on another package:

Got TLS error trying to find package vector_math at https://pub.dartlang.org

I've googled alot but couldn't find the right solution. Please do tell me the main cause of this issue and how to solve it?

Bouillabaisse answered 18/11, 2018 at 14:43 Comment(0)
S
4

For those who find their way to this answer via Google, here's what worked for me. I am running Windows 10 x64 behind a corporate firewall (Zscaler), and my client uses a self-signed cert. I eventually found this Github comment which described creating a system environment variable pointing to the self-signed cert. Once I created the variable and restarted my command prompts, I was able to execute commands like flutter pub get.

Society answered 5/1, 2021 at 20:49 Comment(2)
where can I find tthe self-signed cert?Donelladonelle
If you're working with or for an organization that uses a self-signed certificate, then there is likely someone who can help you get the cert. I think it is also possible to find the certificate from your browser or thru openssl (superuser.com/q/97201/485406).Society
B
4

In the virtual machine, if your network working properly then check the date and time.

Bacteria answered 28/12, 2021 at 12:51 Comment(1)
It was the time on my laptop thank you.Weikert
D
2

You might need to setup a self-signed certificate to make it work correctly by setting the following enviroment variables:

On Linux:

export DART_VM_OPTIONS="--root-certs-file={path.to.certificate.file}"

On Windows:

set https_proxy="--root-certs-file={path.to.certificate.file}"

And in case you behind a proxy, please, also set the proxy variables:

Linux:

export https_proxy="USERNAME:PASSWORD@hostname:port"

Windows:

set https_proxy=USERNAME:PASSWORD@hostname:port

Diametral answered 28/11, 2018 at 16:24 Comment(3)
can you please explain how can i get this self signed certificate ?Slather
Probably with you organizationDiametral
Shouldn´t the first line on Windows be: set DART_VM_OPTIONS="--root-certs-file={path.to.certificate.file}"Blackout
D
2

In my case it was due to network permissions in our organization. I tried with some another network which has full access and my issue was resolved.

Delate answered 1/5, 2019 at 5:24 Comment(0)
A
0

It's working for me
My example:
1. Add dependency to pubspec.yaml file:

dependencies:
http:
git:
url: git://github.com/dart-lang/http.git

  1. When run cmd: flutter packages get. A error will appear at "http_parser" package
  2. Now, download "http_parser" package from https://pub.dev/ (Version tab -> archive) and extract it to (if it not existed) %FLUTTER_HOME%.pub-cache\hosted\pub.dartlang.org
  3. Add new line in pubspec.lock file (at root folder of project)

http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.3"

  1. Finally, run cmd: flutter packages get again!

see more: Using Flutter Package

Anderson answered 9/12, 2019 at 4:38 Comment(0)
A
0

I did try many solutions but when I used a VPN it worked .. It seems to happen in some countries.

Anticlockwise answered 26/5, 2021 at 12:58 Comment(0)
C
0

I'm using ZScaler on Windows. Fortunately, I had the ZScaler root certificate sent over by someone from my corporate IT service desk team. The file name is ZscalerRootCA.cer And then, I used the following value for DART_VM_OPTIONS

--root-certs-file=C:\$PATH_TO_ZscalerRootCA.cer

Cini answered 25/6, 2021 at 14:59 Comment(0)
S
0

I solved my problem by executing the windows update trubleshooting.

Septuplet answered 19/7, 2021 at 7:39 Comment(0)
C
0

I was this problem too.

  • I changed my network from Mobile data to WiFi.
  • run Flutter doctor -v.
  • I changed My VPN.

its was be ok.

Callus answered 8/9, 2023 at 14:12 Comment(0)
S
0

In my case, my clock was behind. I mean, the time of my computer was not correct. Whenever I change the time correctly, the error was gone

Schurman answered 1/9, 2024 at 4:59 Comment(0)
E
-1

Make sure your system's Date and Time are correct.

Enviable answered 15/2, 2022 at 4:23 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.