I tried updating a Laravel project I\'m working on today using composer update
But it hung on Updating dependencies (including require-dev)
check the path of [xdebug] zend_extension = "file/path" in php.ini
So it turns out the problem was with php's xdebug
extension. After disabling it in my php.ini
, composer ran without any problems.
And just to note, the hang-up wasn't actually occurring while reading files from the cache. It was the step right after where composer was trying to resolve dependencies. It just never finished that step and never printed the output. That's why no matter what I did, it always appeared to be stuck reading a file from the cache.
this worked for me:
composer self-update
1st of all : Check firewall and proxy connections. If everything is ok but composer is still hanging try to clear composer cache:
composer clear-cache
https://getcomposer.org/doc/03-cli.md#clear-cache
2nd option If these steps does not repair your composer then it's possible that the system does not have enough RAM memory available (I faced this problem and the symptomps were the same that you describe). At this point you have two options:
a) Increase memory (Virtual Machines or Docker) : Your container or VM needs more available memory. Follow this guide: https://stackoverflow.com/a/44533437/3518053
b) Generate swap file (Linux) : Try creating a swap file to provide more memory: (Above commands are from composer killed while updating)
free -m
mkdir -p /var/_swap_
cd /var/_swap_
#Here, 1M * 2000 ~= 2GB of swap memory
dd if=/dev/zero of=swapfile bs=1M count=2000
mkswap swapfile
swapon swapfile
chmod 600 swapfile
echo "/var/_swap_/swapfile none swap sw 0 0" >> /etc/fstab
#cat /proc/meminfo
free -m
For me the issue was with xDebug. I was using IDE's terminal, and the debugger was listening to incoming connections (as always). Turning the listening off (without requiring to disable the extension) solved the issue.
Some times it is stuck because it is trying to use HTTP instead of https so just run this
composer config --global repo.packagist composer https://packagist.org