沃梦达 / 编程问答 / php问题 / 正文

尽管 --prefer-dist 标志,作曲家依赖项的更新缓慢

Slow updating of composer dependencies, despite --prefer-dist flag(尽管 --prefer-dist 标志,作曲家依赖项的更新缓慢)

本文介绍了尽管 --prefer-dist 标志,作曲家依赖项的更新缓慢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么我的作曲家依赖项最多需要两分钟才能更新,即使没有任何更改?

Why does it take up to two minutes for my composer dependencies to update, even when there have been no changes?

流行建议是附加 --prefer-dist 标志:

php composer.phar update --prefer-dist

但这对我的情况没有影响.下面是我的 composer.json 文件——我是否遗漏了一些明显的东西?

But this makes no difference in my case. Below is my composer.json file – am I missing something obvious?

{
    "name": "my-namespace/symfony",
    "type": "project",
    "description": "",
    "require": {
        "php": ">=5.3.3",
        "symfony/symfony": "2.3.*",
        "doctrine/orm": ">=2.2.3,<2.4-dev",
        "doctrine/doctrine-bundle": "1.2.*",
        "twig/extensions": "1.0.*",
        "symfony/assetic-bundle": "2.3.*",
        "symfony/monolog-bundle": "2.3.*",
        "sensio/framework-extra-bundle": "2.3.*",
        "sensio/generator-bundle": "2.3.*",
        "sensio/distribution-bundle": "2.2.*",
        "my-namespace/my-bundle": "1.0.*"
    },
   "repositories": [
        {
            "type": "vcs",
            "url": "http://username:password@git.com/my-bundle.git"
        }
    ],    
    "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"
        ]
    },
    "config": {
        "bin-dir": "bin"
    },
    "minimum-stability": "dev",
    "extra": {
        "symfony-app-dir": "app",
        "symfony-web-dir": "web",
        "branch-alias": {
            "dev-master": "2.3-dev"
        }
    }
}

推荐答案

这个问题通常与在 CLI 环境中加载 xdebug 有关.(是否启用 xdebug 无关紧要.)

This problem is often related to xdebug being loaded in your CLI environment. (It doesn't matter if xdebug is enabled or not.)

您可以使用以下命令之一检查是否启用了 xdebug.

You can check whether xdebug is enabled using one of the followinc commands.

// Unix
php -m | grep xdebug
// Windows
php -m | findstr xdebug

通过启用最大详细程度和分析信息,可以获得有关哪些操作需要这么长时间的更多信息.(如果要更新软件包,请将 install 替换为 update.)

Further information on what operations take so long can be gained by enabling maximum verbosity and profiling information. (Replace install with update if you are updating the packages.)

composer install --prefer-dist -vvv --profile

这篇关于尽管 --prefer-dist 标志,作曲家依赖项的更新缓慢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:尽管 --prefer-dist 标志,作曲家依赖项的更新缓慢

基础教程推荐