Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Composer hanging while updating dependencies

I tried updating a Laravel project I'm working on today using composer update

But it hung on Updating dependencies (including require-dev)

So I tried things like updating composer, dump-autoload, but nothing seemed to work. Then I ran it in verbose mode: composer update -vvv

And I noticed it hung while reading this json:

Reading path/to/Composer/repo/https---packagist.org/provider-cordoval$hamcrest-php.json from cache 

I tried searching for cordoval/hamcrest-php on packagist.org and couldn't find it. This isn't listed as a dependency in my composer.json

Searching through my vendor folder, I notice the mockery/mockery package I use requires hamcrest/hamcrest-php, but I can't find anything that makes any reference to cordoval.

Any idea what's wrong and how I can fix it so that I can do the update?

Here's my composer.json:

{     "name": "laravel/laravel",     "description": "The Laravel Framework.",     "keywords": ["framework", "laravel"],     "license": "MIT",     "require": {         "laravel/framework": "4.2.*",         "iron-io/iron_mq": "dev-master",         "phpunit/phpunit": "4.2.*",         "mockery/mockery": "dev-master",         "xethron/migrations-generator": "dev-master",         "mailgun/mailgun-php": "dev-master"     },     "autoload": {         "classmap": [             "app/commands",             "app/controllers",             "app/models",             "app/database/migrations",             "app/database/seeds",             "app/tests/TestCase.php"         ]     },     "scripts": {         "post-install-cmd": [             "php artisan clear-compiled",             "php artisan optimize"         ],         "post-update-cmd": [             "php artisan clear-compiled",             "php artisan optimize"         ],         "post-create-project-cmd": [             "php artisan key:generate"         ]     },     "config": {         "preferred-install": "dist"     },     "minimum-stability": "stable" } 

Update

I've tried removing some of the packages from my composer.json, including the "mockery/mockery" package. The only change it made was that Composer would hang on a different file.

After leaving Composer running like that for quite a long time, it finally exited with an error such as the following:

/path/to/ComposerSetup/bin/composer: line 18:  1356 Segmentation fault      php "${dir}/composer.phar" $* 

Not sure what to do about that...

like image 466
Chris Avatar asked Sep 14 '15 21:09

Chris


People also ask

Why is composer update so slow?

Composer update is very slow if you have a lot of dependencies/packages implemented. You should avoid variable versions and think about using a HHVM as server.

How do I update dependency in composer?

Updating dependencies to their latest versions# To update to the latest versions, use the update command. This will fetch the latest matching versions (according to your composer.json file) and update the lock file with the new versions.

Why was composer killed?

The "Killed" message usually means your process consumed too much memory, so you may simply need to add more memory to your system if possible. At the time of writing this answer, I've had to increase my virtual machine's memory to at least 768MB in order to get composer update to work in some situations.


1 Answers

In my case, it was simply taking a very long time on my 8GB ram Mac. To check the progress and verify that it is going through the dependencies, run composer in verbose mode. This was an approach I missed in the question so worth re-stating here.

composer update -vvv 
like image 191
Onshop Avatar answered Sep 16 '22 13:09

Onshop