composer: WSL W11 PHP8.1 : A connection timeout was encountered

My composer.json:

{
    "type": "project",
    "license": "proprietary",
    "minimum-stability": "stable",
    "prefer-stable": true,
    "require": {
        "php": "^8.1",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "composer/package-versions-deprecated": "1.11.99.4",
        "doctrine/annotations": "^1.0",
        "doctrine/doctrine-bundle": "^2.5",
        "doctrine/doctrine-migrations-bundle": "^3.2",
        "doctrine/orm": "^2.10",
        "phpdocumentor/reflection-docblock": "^5.3",
        "phpstan/phpdoc-parser": "^1.2",
        "sensio/framework-extra-bundle": "^6.1",
        "symfony/asset": "6.0.*",
        "symfony/console": "6.0.*",
        "symfony/dotenv": "6.0.*",
        "symfony/expression-language": "6.0.*",
        "symfony/flex": "^2",
        "symfony/form": "6.0.*",
        "symfony/framework-bundle": "6.0.*",
        "symfony/http-client": "6.0.*",
        "symfony/intl": "6.0.*",
        "symfony/mailer": "6.0.*",
        "symfony/mime": "6.0.*",
        "symfony/monolog-bundle": "^3.1",
        "symfony/notifier": "6.0.*",
        "symfony/process": "6.0.*",
        "symfony/property-access": "6.0.*",
        "symfony/property-info": "6.0.*",
        "symfony/proxy-manager-bridge": "6.0.*",
        "symfony/runtime": "6.0.*",
        "symfony/security-bundle": "6.0.*",
        "symfony/serializer": "6.0.*",
        "symfony/string": "6.0.*",
        "symfony/translation": "6.0.*",
        "symfony/twig-bundle": "6.0.*",
        "symfony/validator": "6.0.*",
        "symfony/web-link": "6.0.*",
        "symfony/yaml": "6.0.*",
        "twig/extra-bundle": "^2.12|^3.0",
        "twig/twig": "^2.12|^3.0"
    },
    "require-dev": {
        "phpunit/phpunit": "^9.5",
        "symfony/browser-kit": "6.0.*",
        "symfony/css-selector": "6.0.*",
        "symfony/debug-bundle": "6.0.*",
        "symfony/maker-bundle": "^1.0",
        "symfony/phpunit-bridge": "^6.0",
        "symfony/stopwatch": "6.0.*",
        "symfony/web-profiler-bundle": "6.0.*"
    },
    "config": {
        "allow-plugins": {
            "composer/package-versions-deprecated": true,
            "symfony/flex": true,
            "symfony/runtime": true
        },
        "optimize-autoloader": true,
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php72": "*",
        "symfony/polyfill-php73": "*",
        "symfony/polyfill-php74": "*",
        "symfony/polyfill-php80": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "6.0.*"
        }
    }
}

Output of composer diagnose:

Checking composer.json: WARNING
require.composer/package-versions-deprecated : exact version constraints (1.11.99.4) 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: OK
Checking github.com rate limit: A connection timeout was encountered. If you intend to run Composer without connecting to the internet, run the command again prefixed with COMPOSER_DISABLE_NETWORK=1 to make Composer run in offline mode.
FAIL
[Composer\Downloader\TransportException] curl error 28 while downloading https://api.github.com/rate_limit: Resolving timed out after 10000 milliseconds
Checking disk free space: OK
Checking pubkeys: 
Tags Public Key Fingerprint: xxx
Dev Public Key Fingerprint: xxx
OK
Checking composer version: OK
Composer version: 2.2.3
PHP version: 8.1.1
PHP binary path: /usr/bin/php8.1
OpenSSL version: OpenSSL 1.1.1f  31 Mar 2020
cURL version: 7.68.0 libz 1.2.11 ssl OpenSSL/1.1.1f
zip: extension present, unzip present, 7-Zip not available

When I run this command:

composer update / composer install / composer require

I get the following output:

A connection timeout was encountered. If you intend to run Composer without connecting to the internet, run the command again prefixed with COMPOSER_DISABLE_NETWORK=1 to make Composer run in offline mode.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

I can’t work on any project anymore, I don’t know what to do… I am on Windows 11 21H2 22000.376 with WSL Ubuntu 20.04.3 LTS then Composer 2.2.4 with PHP 8.1.1, I have the connection well I can ping everything the only tool that does not work is composer (require, install, update…)