Composer install/update not working

2020-03-01 06:08发布

问题:

I have a problem with Composer Package Manager. System is Ubuntu 12.04. I just can't make it work. I pulled my git project and try to run 'composer install', but it seems that nothing actually happens. I just get an information

Installing dependencies (including require-dev)

then nothing actually happens. This is my log from this command run with -vvv parameter:

here

Does anyone have any idea what can be wrong ? I tried to clear cache, it did not help. I am sure this repo works well as I pulled it to my Windows machine and it downloaded everything just fine. 'composer diagnose' also returned OK. Thanks for any tips.

回答1:

In first place You should try clearing composer cache.

rm -rf ~/.composer/cache

But more probably it's issue connected with available memory. Increasing memory_limit should help.



回答2:

Try to view a verbose report:

composer install -vvv

or:

composer update -vvv

If last line shows that process is killed, you need to increase your swap memory:

sudo dd if=/dev/zero of=/swapfile bs=1024 count=512k
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
swapon -s

if it continues killing the process, you need to increase 512k to 1024k or maybe 2048k



回答3:

Try with this one and make sure that the composer.json file exist in your project directory.

COMPOSER=composer.json composer update 


回答4:

Though similar answer has already been posted above but still , if composer install / update is not working try doing composer diagnose.. please refer..

https://getcomposer.org/doc/articles/troubleshooting.md

worked for me after updating my composer.. also sometimes internet might be the issue.. Happy Coding! :D



回答5:

I had this issue and realised I had xdebug enabled. Disabling it fixed the issue for me.