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

Composer 2.0.3 can not connect to packagist #9376

Closed
ghost opened this issue Oct 29, 2020 · 48 comments
Closed

Composer 2.0.3 can not connect to packagist #9376

ghost opened this issue Oct 29, 2020 · 48 comments
Labels
Milestone

Comments

@ghost
Copy link

ghost commented Oct 29, 2020

Since I updated from version 1 to version 2.0.3 I can not connect to packagist anymore.

Output of composer diagnose:

Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: [Composer\Downloader\TransportException] Resolving timed out after 10002 milliseconds
Checking https connectivity to packagist: [Composer\Downloader\TransportException] Resolving timed out after 10006 milliseconds
Checking github.com rate limit: FAIL
[Composer\Downloader\TransportException] Resolving timed out after 10004 milliseconds
Checking disk free space: OK
Checking pubkeys: 
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: FAIL
[Composer\Downloader\TransportException] Resolving timed out after 10003 milliseconds
Composer version: 2.0.3
PHP version: 7.4.11
PHP binary path: /usr/local/Cellar/php/7.4.11/bin/php
OpenSSL version: OpenSSL 1.1.1g  21 Apr 2020
cURL version: 7.73.0 libz 1.2.11 ssl OpenSSL/1.1.1h
zip extension: OK

When I run this command:

composer create-project symfony/skeleton test

I get the following output:

Creating a "symfony/skeleton" project at "./test"

                                                
  [Composer\Downloader\TransportException]      
  Resolving timed out after 10002 milliseconds  
                                                

create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--add-repository] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--remove-vcs] [--no-install] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--ask] [--] [<package>] [<directory>] [<version>]
@Toflar
Copy link
Contributor

Toflar commented Oct 29, 2020

That was probably just a temporary issue? Can't reproduce :)

@ghost
Copy link
Author

ghost commented Oct 29, 2020

The problem seems to be connected to my system. In my Docker containers Composer works just fine. On my system the problem still persists. Yesterday when I had Composer 1 everything worked fine.

@composer composer deleted a comment from sprymiker Oct 29, 2020
@Seldaek
Copy link
Member

Seldaek commented Oct 29, 2020

Resolving timed out sounds like DNS issue. I don't know if you can try another DNS resolver perhaps?

@bonovski
Copy link

bonovski commented Oct 29, 2020

I have the same issue since updating to 2.0.0, now at 2.0.3.
It certainly isn't a DNS issue, because everything worked fine a minute before updating to 2.0.0

Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: [Composer\Downloader\TransportException] Resolving timed out after 10004 milliseconds
Checking https connectivity to packagist: [Composer\Downloader\TransportException] Resolving timed out after 10002 milliseconds
Checking github.com rate limit: FAIL
[Composer\Downloader\TransportException] Resolving timed out after 10004 milliseconds
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: FAIL
[Composer\Downloader\TransportException] Resolving timed out after 10004 milliseconds
Composer version: 2.0.3
PHP version: 7.4.11
PHP binary path: /usr/local/Cellar/php/7.4.11/bin/php
OpenSSL version: OpenSSL 1.1.1g  21 Apr 2020
cURL version: 7.73.0 libz 1.2.11 ssl OpenSSL/1.1.1h
zip extension: OK

@stof
Copy link
Contributor

stof commented Oct 29, 2020

it does not only fail to connect to packagist but also to github.com
Are you using some proxy ?

@bonovski
Copy link

I found the problem, there was indeed a DNS issue that composer 1.x.x apparently didn't have an issue with.
I had these DNS servers in my network settings:

192.168.1.1
8.8.8.8
1.1.1.1

The first entry was a pihole rpi, that I haven't used for some time now. After I deleted it everything works fine.
Seems like it wouldn't skip to the next two entries because I was able to ping github.com and repo.packagist.org without problems.

@stof
Copy link
Contributor

stof commented Oct 29, 2020

maybe curl resolves DNS different that when using PHP streams. Composer 2 now uses curl by default.

@Seldaek
Copy link
Member

Seldaek commented Oct 29, 2020

@joergmoldenhauer have you checked your machine's DNS servers? It might be that it works in docker because it's using another DNS resolver there?

@rafhun
Copy link

rafhun commented Oct 30, 2020

I had the same exact issue and adjusting my DNS settings (also a faulty first entry) has now solved it.

@Seldaek Seldaek added this to the 2.0 milestone Oct 30, 2020
@ghost
Copy link
Author

ghost commented Oct 30, 2020

I have no problematic DNS entry in my network settings.

However, when I turn IPV6 off (like described here https://www.maximumbuilders.my/news/trouble-shooting-on-composer-timeout) Composer works again. I wonder why it does not work with IPV6.

@Seldaek
Copy link
Member

Seldaek commented Oct 30, 2020

Also weird that curl would fail over ipv6 but that Composer 1 using php streams was doing fine.. networks are hell :/

@ghost
Copy link
Author

ghost commented Oct 30, 2020

I do not want to turn IPV6 fully off. I found this solution: composer/packagist#950

So I entered the following line to my /etc/hosts file.

142.44.164.255 repo.packagist.org

Composer now works but when installing Symfony I get the following error.

Resolving timed out after 10003 milliseconds
https://flex.symfony.com/versions.json could not be fully loaded, package information was loaded from the local cache and may be out of date
Failed to download recipe: Resolving timed out after 10011 milliseconds
Failed to download recipe: Resolving timed out after 10010 milliseconds

Can anybody tell me how I can enable IPV4 for the recipes server like I did for repo.packagist.org?

@Seldaek
Copy link
Member

Seldaek commented Oct 30, 2020

If you're gonna hardcode an IP (which may bite you in the ass later if we ever rotate it out..), please at least run a ping -4 repo.packagist.org to get an IP in your region. The one you have now is in north america which may not be the nearest to you.

You can do the same for flex.symfony.com, and then github.com, etc.. but that seems really suboptimal. It'd be better to resolve the ipv6 issues.

@ghost
Copy link
Author

ghost commented Oct 30, 2020

I just talked to our network admin here at work. It seems to be an internal problem with our network. He advised me to turn IPv6 off (like I did before).

Composer now works fine and is super fast. Thank you all for your help!

@illegaluid
Copy link

I have no problematic DNS entry in my network settings.

However, when I turn IPV6 off (like described here https://www.maximumbuilders.my/news/trouble-shooting-on-composer-timeout) Composer works again. I wonder why it does not work with IPV6.

same problem. thanks

@tombroucke
Copy link

I ran in to a similar problem. My primary DNS was my Pi-hole (192.168.2.2), secondary 1.1.1.1. Everything in my networked seemed to work just fine, except for Composer.
I tried updating my pi-hole over SSH, but the latest version couldn't be download from github.com. The default gateway was pointing to an old router's IP address. After correcting the default gateway in my raspberry pi, I was able to update pi-hole, and all Composer commands ran like they should.

@MohammadShakilCSE
Copy link

Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: FAIL
[Composer\Downloader\TransportException] curl error 28 while downloading https://repo.packagist.org/packages.json: Connection timed out after 10016 milliseconds
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0 87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B 0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: FAIL
[Composer\Downloader\TransportException] curl error 28 while downloading https://getcomposer.org/versions: Connection timed out after 10033 milliseconds
Composer version: 2.0.8
PHP version: 8.0.0
PHP binary path: F:\Server\php\php.exe
OpenSSL version: OpenSSL 1.1.1h 22 Sep 2020
cURL version: 7.73.0 libz 1.2.11 ssl OpenSSL/1.1.1h
zip: extension present, unzip not available

what is the problem

@NicolasHalberstadt
Copy link

@MohammadShakilCSE I don't know if that's your case but I had an antivirus Proxy (ESET) that was blocking the installation. I disabled it and it's working like a charm. I don't really know how you're supposed to deal with it .. but I was planning on changing antivirus anyway so...

@redmatrix
Copy link

Since nothing else worked and I don't actually have control over the machines/networks that are giving me grief I have changed the curl connect timeout in /usr/share/php/Composer/Util/Http/CurlDownloader.php . 10 seconds was not enough to reliably get through all the packet filtering. I bumped it to 30 and now it works like a charm. Your mileage may vary.

@Seldaek
Copy link
Member

Seldaek commented Nov 25, 2021

Really? 10 seconds not enough to connect? :/

@redmatrix
Copy link

Correct. My biggest problems incidentally appear to be within the Drupal project infrastructure someplace but it might be a combinatorial effect related to our service provider (Telstra/Australia) and the fact that I'm somewhat remote even for Australia. Access to everything goes across slower links and trans-Pacific packets naturally take a bit longer in the best of cases. And quite possibly I'm getting routed through a satellite link somewhere in the chain. I'm not assigning blame because frankly I have other priorities beyond investigating to that level. I'm just saying it's outside my control and 30 seconds works.

@Seldaek
Copy link
Member

Seldaek commented Nov 27, 2021

@redmatrix ok I see. I would say maybe try Private Packagist otherwise, we do have servers in Singapore so using the mirroring there probably would help.

@Md-Abul-Hasan
Copy link

I saw this issue
[Composer\Downloader\TransportException]
curl error 28 while downloading https://repo.packagist.org/packages.json: Connection timed out after 10007 millisec
onds
how to solve this

@isekaimaou1109
Copy link

I saw this issue [Composer\Downloader\TransportException] curl error 28 while downloading https://repo.packagist.org/packages.json: Connection timed out after 10007 millisec onds how to solve this

I think it's not error (maybe bug). In my case, i run this command composer create-project --prefer-dist laravel/laravel <app-name> --ignore-platform-req=ext-fileinfo to create laravel project. I hope this will help you @Md-Abul-Hasan

@luqmanyusof
Copy link

I saw this issue [Composer\Downloader\TransportException] curl error 28 while downloading https://repo.packagist.org/packages.json: Connection timed out after 10007 millisec onds how to solve this

im facing the same issue with this.

@mateentechbits
Copy link

$ composer require laravel/jetstream
https://repo.packagist.org could not be fully loaded (curl error 28 while downloading https://repo.packagist.org/packages.json: Connection timed out after 10007 milliseconds), package information was loaded from the local cache and may be out of date

[Composer\Downloader\TransportException]
curl error 28 while downloading https://repo.packagist.org/p2/laravel/jetstream.json: Connection timed out after 10
012 milliseconds

require [--dev] [--dry-run] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--fixed] [--no-suggest] [--no-progress] [--no-update] [--no-install] [--update-no-dev] [-w|--update-with-dependencies] [-W|--update-with-all-dependencies] [--with-dependencies] [--with-all-dependencies] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUTOLOADER-PREFIX] [--] []...

@sdapkus
Copy link

sdapkus commented Feb 1, 2022

Had same problem on composer 2.2.5 inside docker container.
Updated all packages inside container and it started to work. These were the packages that got updated:

Note: I'm using php 8.0, but docker image contains some packages from php 8.1

The following packages will be upgraded:
  libsystemd0 libudev1 php8.1-cli php8.1-common php8.1-opcache php8.1-phpdbg php8.1-readline

@AlarconJesus
Copy link

Hello!, in my case was the port 8080, was taked, so I killed the process with TASKKILL /PID NumberOfTheProcess /F. And after that I tried again and it works.
NumberOfTheProcess I found using netstat -ano.

@Wesley-Sinde
Copy link

Wesley-Sinde commented Feb 24, 2022

  • This mostly comes from your firewalls or ipv6.

  • You can disable the firewalls or disable ipv6 in youur machine for it to work.

  • Also you can use the following code to create your project. I hope this will assist..

composer create-project --prefer-dist laravel/laravel <app-name> --ignore-platform-req=ext-fileinfo

@jvbalcita
Copy link

I'm having the same issue when trying to install Laravel 9, PHP 8.1 getting the error message

[Composer\Downloader\TransportException]
curl error 35 while downloading https://repo.packagist.org/packages.json: OpenSSL SSL_connect: Connection was reset
in connection to repo.packagist.org:443

I've reached out to our cloud engineer regarding this issue and both ports 80 and 443 is enabled
Tried disabling the ipv6 but GCP instance is not using it.

Hope someone can help on this.

@6157work
Copy link

composer diagnose
Checking composer.json: OK
Checking platform settings: The Windows OneDrive folder is not supported on PHP versions below 7.2.23 and 7.3.10.
Upgrade your PHP (7.3.4) to use this location with Composer.

Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: FAIL
[Composer\Downloader\TransportException] curl error 35 while downloading https://api.github.com/rate_limit: SSL connect error
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0 87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B 0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
Composer version: 2.2.9
PHP version: 7.3.4
PHP binary path: D:\phpstudy_pro\Extensions\php\php7.3.4nts\php.exe
OpenSSL version: OpenSSL 1.1.1b 26 Feb 2019
cURL version: 7.64.0 libz 1.2.11 ssl OpenSSL/1.1.1b
zip: extension present, unzip not available, 7-Zip not available

@mzarain08
Copy link

Creating a "laravel/laravel" project at "./example-app" (Windows, Command Prompt, Terminal)

In CurlDownloader.php line 375:

curl error 28 while downloading https://repo.packagist.org/packages.json: Timeout was reached

create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--add-repository] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] [--keep-vcs] [--remove-vcs] [--no-install] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--ignore-platform-reqs] [--ask] [--] [ [ []]]

Any help why its Timeout.

@altwei
Copy link

altwei commented May 16, 2022

Checking composer.json: WARNING
require.guzzlehttp/guzzle : exact version constraints (7.4.x-dev) should be avoided if the package follows semantic versioning
require.psr/log : exact version constraints (3.x-dev) should be avoided if the package follows semantic versioning
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: FAIL
[Composer\Downloader\TransportException] curl error 77 while downloading https://repo.packagist.org/packages.json: Problem with the SSL CA cert (path? access rights?)
Checking github.com rate limit: FAIL
[Composer\Downloader\TransportException] curl error 77 while downloading https://api.github.com/rate_limit: Problem with the SSL CA cert (path? access rights?)
Checking disk free space: OK
Checking pubkeys: FAIL
Missing pubkey for tags verification
Missing pubkey for dev verification
Run composer self-update --update-keys to set them up
Checking composer version: FAIL
[Composer\Downloader\TransportException] curl error 77 while downloading https://getcomposer.org/versions: Problem with the SSL CA cert (path? access rights?)
Composer version: 2.3.5
PHP version: 8.1.6
PHP binary path: /home/altwei/software/php81/bin/php
OpenSSL version: OpenSSL 1.1.1f 31 Mar 2020
cURL version: 7.68.0 libz 1.2.11 ssl NSS/3.49.1
zip: extension present, unzip present, 7-Zip not available

What is the problem ?

@altwei
Copy link

altwei commented May 16, 2022

cURL version: 7.68.0 libz 1.2.11 ssl NSS/3.49.1

This NSS is wrong?

@altwei
Copy link

altwei commented May 16, 2022

  1. sudo apt remove -y libcurl4-nss-dev
  2. sudo apt install -y libcurl4-openssl-dev
  3. recompile install php

That solved my problem

@elsayadewb
Copy link

thanks

@ayan013
Copy link

ayan013 commented Jun 28, 2022

I am facing the same issue now in Ubuntu 20.04 and using php 7.4.

composer diagnose

image

Traceroute result:

image

@AlexeyPlodenko
Copy link

The problem in my case was caused by a running proxy app - Progress Telerik Fiddler Classic.

Switched it off and the "composer update" worked.

@oliiix
Copy link

oliiix commented Mar 25, 2023

syr for the harsh language before, i was very frustrated after a while. had that and can't understand it, my network and everything else are totally fine.

curl error 6 while downloading https://repo.packagist.org/packages.json: getaddrinfo() thread failed to start

reinstalled it via scoop, via choco, manually,my network is totally fine!! and i want that to work no matter if I have special configs. And if every other app can reach the destination, so should curl.
i added the certificate file, checked my dns (nothing in there), tested with different dns ips, removed IPv6 networking, disabled my firewall, disabled vmware network adapters, hardcoded the ip and domain into my hosts file, reinstalled everything but my operating system, i tried literally everything. That problem is everywhere as google also says. isn't there anything else than curl that could be used????

@cmuench
Copy link

cmuench commented Mar 25, 2023

@oliiix bye bye Composer? Are you writing your own package manager for PHP?

@oliiix
Copy link

oliiix commented Mar 26, 2023

yes, I'm sorry for my harsh language. corrected it a little, but after a week of software problems only, it's getting frustrating. and no i'm certainly not writing a package manager :'D I rather download zip files and distribute them to where I need them. it's fasterfor me and my few use cases, but i have to use composer, they don't offer it any other way, but I asked for a zip file now...

@RobLoach
Copy link
Contributor

Could always use PHAR or PEAR 😉 .... Composer just gets better and more secure with each version. If you're having issues, it's likely because of SSL or access problems. My suggestion would be to...

  1. Run composer diagnose to try to find out what's wrong
  2. A github access token can help with getting over rate limits https://www.previousnext.com.au/blog/managing-composer-github-access-personal-access-tokens
  3. Follow the Composer documentation to install, or install using a tool on your operating system, like brew, or just using the composer.phar.
  4. Use php -i to diagnose some potential PHP issues. cURL support can help.
  5. If you're getting frustrated, take a break. You won't get anywhere by yelling at your computer.

@cmuench
Copy link

cmuench commented Mar 26, 2023

@cmuench that would not be too difficult tbh

Don't underestimate the complexity which is covered by Composer.

@ecxod
Copy link

ecxod commented May 7, 2023

please check if you have "mod_security" or "mod_security2" enabled in your apache2
If you have access to the settings they are usually in /etc/modsecurity you can go like this :

mcedit /etc/modsecurity/crs/packagist.conf

SecRule SERVER_NAME "composer.org" \
    "id:1000,phase:1,t:none,nolog,allow,ctl:ruleEngine=Off"

SecRule SERVER_NAME "packagist.org" \
    "id:1001,phase:1,t:none,nolog,allow,ctl:ruleEngine=Off"

SecRule REMOTE_ADDR "@ipMatch 185.85.2.0/22" \
    "id:1002,phase:1,t:none,nolog,allow,ctl:ruleEngine=Off"

SecRule REMOTE_ADDR "@ipMatch 146.59.12.128/25" \
    "id:1003,phase:1,t:none,nolog,allow,ctl:ruleEngine=Off"

then

service apache2 restart

and have fun

@sotmir
Copy link

sotmir commented Jul 14, 2023

My solution to this error, when I was trying to build a Laravel app with docker, was to change the MTU on the network configuration of the docker container. This depends on the MTU configuration that the host has, in our case was 1400. We had to apply this configuration for the network on the docker-compose.yaml file:
networks: my-net: driver: bridge driver_opts: com.docker.network.driver.mtu: 1400

As suggested in this article: https://help.nordlayer.com/docs/docker-mtu-configuration

And then applied this network to all images in the file like this:
MySQL: image: mariadb:10.11 networks: - my-net

@LocalHeroPro
Copy link

LocalHeroPro commented Jul 19, 2023

I have same issue on my Laravel app, when thy to install packages.

$ php composer.phar diagnose
Checking platform settings: OK
Checking git settings: OK git version 2.34.1
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: FAIL
[Composer\Downloader\TransportException] curl error 60 while downloading https://api.github.com/rate_limit: SSL: no alternative certificate subject name matches target host name 'api.github.com'
Checking disk free space: OK
Checking pubkeys: 
Tags Public Key Fingerprint: 57815BA2 7E54DC31 7ECC7CC5 573090D0  87719BA6 8F3BB723 4E5D42D0 84A14642
Dev Public Key Fingerprint: 4AC45767 E5EC2265 2F0C1167 CBBB8A2B  0C708369 153E328C AD90147D AFE50952
OK
Checking composer version: OK
Composer version: 2.6-dev+c1f2964105f75d2123783b1a649d6c0260316785
PHP version: 8.2.8
PHP binary path: /usr/bin/php8.2
OpenSSL version: OpenSSL 3.0.2 15 Mar 2022
cURL version: 7.81.0 libz 1.2.11 ssl OpenSSL/3.0.2
zip: extension present, unzip present, 7-Zip present (7z)

Creating personal access token form github don't give solution for that situation.

@boomsya
Copy link

boomsya commented Sep 6, 2023

php 8.2.4
CMD: composer install && npm install && php artisan key:generate

Failed to download symfony/polyfill-ctype from dist: curl error 28 while downloading https://api.github.com/repos/symfony/polyfill-ctype/zipball/5bbc823adecdae860bb64756d639ecfec17b050a: SSL connection timeout
Syncing doctrine/inflector (2.0.8) into cache

@ahmadrzk69
Copy link

I have problem when try to install laravel. The problem is :
failed to download symfony/finder from dist: curl error 28 while downloading https://api.github.com/repos/symfony/finder/zipball/9915db259f67d21eefee768c1abcf1cc61b1fc9e: ssl connection timeout now trying to download from source

How to fix it?

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

No branches or pull requests