为什么作曲家在300秒后安装超时?

我有一个小项目在 symfony2时,我试图建立在我的服务器它总是失败时,解压 symfony。构建还可以,突然作曲家不能解压缩 symfony,我没有改变任何东西。我尝试使用 Jenkins 进行构建,也尝试使用 bash 手动进行构建,得到了相同的结果。这不是权限问题,我的服务器上的互联网连接也没问题。

Loading composer repositories with package information
Installing dependencies (including require-dev) from lock file
- Installing symfony/symfony (v2.3.4)
Downloading: 100%
[Symfony\Component\Process\Exception\ProcessTimedOutException]
The process "unzip '/path/vendor/symfony/symfony/6116f6f3
d4125a757858954cb107e64b' -d 'vendor/composer/b2f33269' && chmod -R u+w 'vendor/composer/b2f33269'" exceeded the timeout of 300 seconds.
105654 次浏览

try composer update/install -o -vvv and check wether the package is being loaded from composer's cache.

if yes try clearing composer's cache or try adding -cache-dir=/dev/null.

To force downloading an archive instead of cloning sources, use the --prefer-dist option in combination with --no-dev.

Otherwise you could try raising composer's process timeout value:

export COMPOSER_PROCESS_TIMEOUT=600   ( defaults to 300 )

Deleting composer cache worked for me.

rm -rf ~/.composer/cache/*

Composer itself impose a limit on how long it would allow for the remote git operation. A look at the Composer documentation confirms that the environment variable COMPOSER_PROCESS_TIMEOUT governs this. The variable is set to a default value of 300 (seconds) which is apparently not enough for a large clone operation using a slow internet connection.

Raise this value using:

COMPOSER_PROCESS_TIMEOUT=2000 composer install

This is the problem slow NFS. Composer write cache into NFS directory. You must install composer globally and rewrite cache path.

This doesnt work:

php composer.phar install

Using this:

composer install

Before this run you must config composer globally. See this https://getcomposer.org/doc/00-intro.md#globally

Also, you must add this lines to your config.json:

"config": {
"cache-dir": "/var/cache/composer"
}

Works for me.

composer config --global process-timeout 2000

The Symfony Component has process timeout set to 60 by default. That's why you get errors like this:

[Symfony\Component\Process\Exception\ProcessTimedOutException]
The process "composer update" exceeded the timeout of 60 seconds.

Solution

Set timeout to 5 minutes or more

$process = new Process("composer update");
$process->setTimeout(300); // 5 minutes
$process->run();

The easiest method is add config option to composer.json file, Add process-timeout 0, That's all. It works anywhere.

{
.....
"scripts": {
"start": "php -S 0.0.0.0:8080 -t public public/index.php"
},
"config": {
"process-timeout":0
}
}

It's an old thread but I found out the reason for time out was running a php debugger (PHPStorm was listening to xdebug connections) which caused the process timeout. When I closed the PHPStorm or disabled the xdebug extension, no time out occurred.

old thread but new problem for me. No solutions here were working when trying to install google/apiclient (it failed on google/apiclient-services) on an Ubuntu VM within a Windows 10 host.

After noticing Windows' "antimalware executable" taking up considerable CPU cycles when doing this composer install/update, I disabled "real-time protection" on the Windows 10 machine, and my composer update/install worked!!

Hope that helps someone.

I agree with most of what has been suggested above, but I had the same issue and what worked for me was deleting the vendor folder and re-run composer install

Regards