我有一个稳定的连接,但是当我在项目根上运行composer update
时,composer总是抛出ComposerDownloaderTransportException
,然后是消息,说明我在下载文件时出现超时错误。
运行composer diagnose
之后,一切似乎都通过了测试。
我尝试卸载,但后来无法安装composer。当我下载带有curl -sS https://getcomposer.org/installer | php
的composer时,composer会将其打印到流中:
~ curl -sS https://getcomposer.org/installer | php -d detect_unicode=Off
All settings correct for using Composer
Downloading...
Download failed: Failed to open https://getcomposer.org/composer.phar (Operation timed out after 4994 milliseconds with 229148 out of 1016883 bytes received)
Downloading...
Download failed: Failed to open https://getcomposer.org/composer.phar (Operation timed out after 4988 milliseconds with 261916 out of 1016883 bytes received)
Downloading...
SlowTimer [5000ms] at curl: https://getcomposer.org/composer.phar
Download failed: Failed to open https://getcomposer.org/composer.phar (Operation timed out after 4996 milliseconds with 147228 out of 1016883 bytes received)
The download failed repeatedly, aborting.
我正在使用Ubuntu 14.04 LTS
。
有什么想法吗?
我以前就建议过。尝试composer update/install -o -vvv
并检查包是否从composer的缓存中加载。
如果是,请尝试清除composer的缓存或尝试添加-cache-dir=/dev/null
。
要强制下载存档而不是克隆源,请将--prefer-dist
选项与--no-dev
结合使用。
否则,您可以尝试提高composer的进程超时值:
export COMPOSER_PROCESS_TIMEOUT=600 ( defaults to 300 )
我不确定这是否适用于您的重新安装选项,但它可能适用于您最初的超时问题(除了Vector的建议);我使用hhvm运行composer,它指定自己的请求超时参数,这些参数覆盖您在composer.json或环境变量中指定的任何内容。上一个链接包含适当的信息来更详细地配置超时,但我的示例bash别名可能会有所帮助。
alias composer='hhvm -v ResourceLimit.SocketDefaultTimeout=60 -v Http.SlowQueryThreshold=60000 -v Eval.Jit=false /home/liam/bin/composer'