The "http://repo.packagist.org/p/paypal/module-braintree-graph-ql%245690cb72028a8444b0f87c92557cb7e772f5e673c323118e1a18304afae1eb14.json" file could not be downloaded: Failed to open stream: Network is unreachable

I am getting this error when running composer update cmd in Magento2.

I already tried by deleting the composer lock, vendor, clear cache etc..

Please help how to solve this

1 Answer 1


The error message you're encountering, "Network is unreachable," indicates that Composer is having trouble connecting to the Packagist repository to download a package. This issue can be caused by various factors, including network issues, firewall settings, or temporary problems on the Packagist server. Here's a step-by-step guide to help you resolve this issue:

  1. Check Your Network Connection:

    • Ensure that your server has an active and stable internet connection. Try pinging external websites (e.g., ping google.com) to verify connectivity.
  2. Firewall and Proxy Settings:

    • If your server uses a firewall or a proxy, make sure that Composer is configured to use the correct proxy settings. You can set these in your composer.json file or through environment variables.
    • Example of proxy settings in composer.json:
      "config": {
          "http-proxy": "http://proxy.example.com:8080",
          "https-proxy": "http://proxy.example.com:8080"
  3. Check Packagist Status:

    • Sometimes, the issue might be on the Packagist side. Check the status of Packagist at https://status.packagist.org/ to see if there are any ongoing issues.
  4. Composer Self-Update:

    • Ensure that you are using the latest version of Composer. Run the following command to update Composer itself:
      composer self-update
  5. Composer Configuration:

    • Check your Composer configuration to ensure it's correctly set up. You can check the global Composer configuration by running:
      composer config -l
      Review the values to make sure there are no conflicting settings.
  6. PHP Version Compatibility:

    • Verify that your PHP version is compatible with the Magento 2 version you're working with. Composer might have difficulty resolving dependencies if there's a PHP version mismatch.
  7. Try a Different Repository:

    • If the issue persists, consider changing the repository URL in your composer.json file to use a mirror or a different repository, although this is not recommended for long-term use:
      "repositories": [
              "type": "composer",
              "url": "https://packagist.org-mirror.com/packagist.org"
  8. Clear Composer Cache:

    • Sometimes, Composer caches files that may be causing issues. Clear the Composer cache with the following command:
      composer clear-cache
  9. Check for DNS Issues:

    • Ensure that your server has correct DNS settings and can resolve domain names. Try running nslookup packagist.org to verify DNS resolution.
  10. Server Maintenance:

    • Sometimes, package servers undergo maintenance, which can temporarily disrupt downloads. Wait for a while and try running composer update again later.
  11. Contact Your Hosting Provider:

    • If you're using a shared hosting environment, your hosting provider might have restrictions that affect Composer's ability to make network requests. Contact them for assistance if necessary.

After trying these steps, attempt to run composer update again to see if the issue is resolved. If you're still facing problems, you may want to consult with Magento support or community forums for specific Magento-related troubleshooting steps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.