developer tip

Composer에서 종속성 업데이트가 그렇게 느린 이유는 무엇입니까?

optionbox 2020. 11. 11. 19:58
반응형

Composer에서 종속성 업데이트가 그렇게 느린 이유는 무엇입니까?


(symfony v 2.1.3) 에 설치된 번들을 관리하기 위해 composer ( http://getcomposer.org/ )를 사용하고 Symfony2있습니다. 작성기의 버전은입니다 de3188c.

composer.json에 새 번들을 추가하고 실행할 때 종속성 업데이트에 대한 메시지를 표시하고 다음에 다운로드 할 때 모두 매우 낮다는 문제가 있습니다.

이 데이터는 composer.json (아래 참조)에 있으며 실행 시간은 약 20 분입니다 !!! 인터넷 연결이 충분히 빠릅니다. 대용량 파일을 매우 빠르게 다운로드 할 수 있습니다.

더 빠르게 만드는 트릭이 있습니까?

{
"name": "symfony/framework-standard-edition",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
    "psr-0": { "": "src/" }
},
"require": {
    "php": ">=5.3.3",
    "symfony/symfony": "2.1.*",
    "doctrine/orm": ">=2.2.3,<2.4-dev",
    "doctrine/doctrine-bundle": "1.0.*",
    "twig/extensions": "1.0.*",
    "symfony/assetic-bundle": "2.1.*",
    "symfony/swiftmailer-bundle": "2.1.*",
    "symfony/monolog-bundle": "2.1.*",
    "sensio/distribution-bundle": "2.1.*",
    "sensio/framework-extra-bundle": "2.1.*",
    "sensio/generator-bundle": "2.1.*",
    "jms/security-extra-bundle": "1.2.*",
    "jms/di-extra-bundle": "1.1.*",
    "doctrine/doctrine-fixtures-bundle": "dev-master",
    "webignition/doctrine-migrations-bundle": "dev-master"
},
"scripts": {
    "post-install-cmd": [
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
    ],
    "post-update-cmd": [
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
    ]
},
"minimum-stability": "dev",
"extra": {
    "symfony-app-dir": "app",
    "symfony-web-dir": "web"
}

composer.json에서 각 종속성에 대한 버전을 지정하고 composer --prefer-dist를 호출 할 때 옵션을 사용하십시오 . 단일 파일 대신 저장소 (사용 가능한 경우)에서 ZIP 파일을 다운로드합니다.

php composer.phar install --prefer-dist

Since you accepted an answer, it looks like that solved your problem. Just in case anybody else stumbles across this question though (like I did when I was searching), in my case, a really slow Composer install had to do with my PHP version (word of warning, I am a complete and utter Composer newbie), even though Composer ran through its standard checks and said everything was fine. I run Ubuntu 12.04 LTS and was too lazy to upgrade from the default PHP 5.3.10 (the same version you're running) in the Precise repo.

Installing Twig via Composer originally took me around 30 minutes. I gave up installing Doctrine after it took more than an hour. I upgraded to 5.4.17 (using this PPA https://launchpad.net/~ondrej/+archive/php5) and installing Doctrine was done in a matter of seconds.


I have found that it is also very slow, in the tens of minutes slow.

For me I added -vvv and found it was hanging at stuff like Downloading https://packagist.org/p/provider-active$53cdf887c8d2925b3501f47d6980fb7bda2310716369bf7a84857c6e62bbab0f.json

I then went to the browser and tried to download that JSON file and sure enough. It was packagist.org to be the cause of the slowness.


In my case, the above suggestions didn't make a difference. What did was to use the HTTPS protocol for packagist:

php composer.phar config --global repo.packagist composer https://packagist.org

or

composer config --global repo.packagist composer https://packagist.org

depending on your setup


To diagnose this use I used the require command with -vvv attribute.

composer require larapack/dd -vvv

In my case I've found that the slow speed of composer was because of fxp/composer-asset-plugin.

composer global show
composer global remove fxp/composer-asset-plugin

and voila

참고URL : https://stackoverflow.com/questions/13413788/why-updating-of-dependencies-in-composer-is-so-slow

반응형