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

Composer安装脚本执行失败[退出码1],求解决思路

Composer安装失败(退出码1)的解决思路
  • 检查代理设置

    • 先关闭全局代理再尝试安装,多数代理拦截会导致这类连接失败问题
    • 若必须使用代理,给Composer配置正确代理参数:
      composer config -g http.proxy http://你的代理地址:端口
      composer config -g https.proxy https://你的代理地址:端口
      
    • 不需要代理的话,清空现有代理配置:
      composer config -g --unset http.proxy
      composer config -g --unset https.proxy
      
  • 验证网络连通性

    • 直接在终端执行curl https://getcomposer.org/versions,或者浏览器访问该地址,确认网络能正常连接到Composer服务器
    • 尝试切换网络(比如手机热点),排除局域网限制导致的连接问题
  • 排查防火墙与安全软件

    • 暂时关闭本地防火墙、杀毒软件,这类工具可能会阻止Composer建立HTTPS连接
    • 检查路由器是否有拦截HTTPS请求的规则
  • 尝试手动安装Composer

    • 脚本安装失败时,直接手动下载安装:
      php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
      php composer-setup.php
      php -r "unlink('composer-setup.php');"
      

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.15 16:01:07