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.
Composer Update very very slow (not completing)
As the title suggests. Running composer update takes a very long time, so much so that I have stopped it.
Anyone else had this issue recently and know of the causes and solutions to fix it?
Try running composer update --profile and leave it running for a few minutes. Let me know what the output looks like.
The project is almost a clean install of L5 apart from Behat.
@ELD:
[8.5MB/0.14s] Loading composer repositories with package information
[9.0MB/20.79s] Updating dependencies (including require-dev)
[358.6MB/123.98s] Nothing to install or update
[168.6MB/124.48s] Generating autoload files
Generating optimized class loader
Memory usage: 167.98MB (peak: 358.86MB), time: 126.73s
Have you done a selfupdate recently?
@bashy, yes I ran that a few hours ago.
Update
I ran it again a moment ago and run composer update --profile again and this time it only took 30 seconds.
What is the cause of it being so slow? I haven't looked into using HHVM just yet, is that easy to set up?
Could be connection to the sites that provide the package info. So many things it could be.
What's your compsoer.json file look like? IIRC, there should be an error on Composer if the provider of the package is down.
@ELD It obviously completes it but if DNS resolving or server/network is slow, it will take longer to complete it.
@bashy true but it should fail if it can't retrieve the package. HIs composer update command is going through to completion.
@ELD Yeah which is why I'm questioning the timeout for package data.
Mine is also taking ages, on a basic Laravel installation, with only a couple of dependencies.
Reading /home/puzbie/.composer/cache/repo/https---packagist.org/provider-symfony$console.json from cache
Reading /home/puzbie/.composer/cache/repo/https---packagist.org/provider-psy$psysh.json from cache
Reading /home/puzbie/.composer/cache/repo/https---packagist.org/provider-swiftmailer$swiftmailer.json from cache
Reading /home/puzbie/.composer/cache/repo/https---packagist.org/provider-illuminate$http.json from cache
Reading /home/puzbie/.composer/cache/repo/https---packagist.org/provider-illuminate$routing.json from cache
Downloading http://packagist.org/p/illuminate/session$ed41cddbebe575b1158e77197847b73b0ffce79183d1e6707c8677dc6c12a8a0.json
It seems to take ages on specific packages. It will eventually complete, but can take over an hour, which is a bit silly. I have a 100mb/s connection, so in theory it should be pretty quick.
There is a working discussion on it. I personally have no worries about it...
The more packages, the longer it takes. Also if you have PHPStorm running and are actively debugging a script using the same PHP exe, composer will hang until you cancel or terminate the debug session.
@jimmck and others, this thread was 4 and a half months old, and yes, it does take longer on specific packages. No, it wasn't to do with debugging (at least not in this case), from what I remember at the time, there were issues with pulling in all packages.
@mstnorris and your point is ?
Turns out there is a simple fix if you are affected:
composer config --global repo.packagist composer https://packagist.org
This forces composer to use https. They are still working out why this is an issue on some setups, but this was the cure for me, at least.
Did the above (as complained about HTTPS now required) and disabled IP6, as I saw a lot of blocked connection requests in the firewall logs.
MY SOLUTION WINDOWS 10 x 64 bits WAMP user with Laravel, after weeks of slow composer update and composer require
you need a thing called cacert.pem
https://curl.haxx.se/docs/caextract.html
then paste that file in your wamp main directory C:\wamp64\cacert.pem
then in the search tab search for php.ini open all the files with that name on sublime or any text editor
find a line called curl.cainfo and openssl.cafile
PUT YOUR PATH TO THIS FILE - see the example on my case:
curl.cainfo="C:\wamp64\cacert.pem"
and
openssl.cafile="C:\wamp64\cacert.pem"
do this on all the php.ini files you search before, in all the files!
OKAY RESTART SERVER that works for me, hope for you I wish someone before would make this comment! so I would not spend 2 weeks fixing it
I think this solves the problem because you need to match HTTPS with HTTPS communication, I think.... each time I run composer Update got the 60ERROR called no SSL so hope this helps someone
Please or to participate in this conversation.