You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Drupal 8项目用Composer下载Drush遇Packages.json SSL超时问题求助

Fixing "Packages.json could not be downloaded, SSL Operation timed out" When Installing Drush via Composer for Drupal 8

Hey there, I’ve dealt with this exact SSL timeout issue a few times when working with Drupal and Composer, so let’s walk through some practical fixes to get Drush installed smoothly:

  • Update Composer to the latest version
    Outdated Composer versions often have SSL-related bugs or compatibility issues. Run this command to update your global Composer install:

    composer self-update
    

    If you run into permission issues on Linux/macOS, prepend sudo:

    sudo composer self-update
    
  • Increase Composer’s timeout limit
    The default timeout might be too short for slow network connections. Try temporarily increasing it when running the Drush install command:

    composer require drush/drush --timeout=300
    

    The 300 here sets a 5-minute timeout—adjust it higher if needed. You can also set this permanently in your global Composer config by running:

    composer config -g process-timeout 300
    
  • Verify and update your system’s CA certificates
    Missing or expired root CA certificates can break SSL verification. Here’s how to refresh them on common systems:

    • For Debian/Ubuntu:
      sudo apt-get update && sudo apt-get install --reinstall ca-certificates
      
    • For CentOS/RHEL:
      sudo yum update ca-certificates
      
    • For macOS: Use Homebrew to update OpenSSL (which includes up-to-date certificates):
      brew install openssl
      
  • Check for network proxies or firewalls
    If you’re on a corporate network, a proxy might be interfering with Composer’s SSL connections. To configure a proxy (replace proxy:port with your actual details):

    composer config -g http.proxy http://proxy:port
    composer config -g https.proxy https://proxy:port
    

    If you don’t need a proxy, clear any existing settings with:

    composer config -g --unset http.proxy
    composer config -g --unset https.proxy
    
  • Try a different Packagist mirror
    Slow access to the default Packagist repository can cause timeouts. Switch to a faster mirror temporarily:

    composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
    

    After installing Drush, you can switch back to the official repo if you want:

    composer config -g repo.packagist composer https://packagist.org
    
  • Temporarily disable SSL validation (last resort)
    This isn’t recommended for long-term use due to security risks, but it can help confirm if the issue is SSL-related. Run:

    composer require drush/drush --insecure
    

    If this works, go back and fix your certificate or network settings instead of relying on this workaround.

Start with updating Composer first—it’s the quickest fix for most SSL-related glitches. If that doesn’t work, work through the other steps one by one, and you should have Drush up and running in no time.

内容的提问来源于stack exchange,提问作者clestcruz

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 03:25:28