【问题标题】:Laravel composer install hangs on "Installing dependencies" and consume a lot of resources (CPU, DISK)Laravel composer install 挂在“正在安装依赖项”并消耗大量资源(CPU,DISK)
【发布时间】:2013-11-18 11:11:06
【问题描述】:

问题一:

我尝试在我的服务器(Ubuntu 12.04、nginx、php5-fpm)上安装 laravel 4,但安装挂起:

# composer install --verbose
Loading composer repositories with package information
Installing dependencies (including require-dev)

- 没有错误,没有任何东西,它只是挂起,仅此而已。 我尝试使用composer create-project laravel/laravel --prefer-dist 进行安装 ...结果几乎一样:

Installing laravel/laravel (v4.0.9)
- Installing laravel/laravel (v4.0.9)
Loading from cache

Created project in /var/www/laravel/ex2/laravel
Loading composer repositories with package information
Installing dependencies (including require-dev)

我找不到任何想法/解决方案。

谁能告诉我是什么问题,我该如何解决?

问题2:

@antonio-carlos-ribeiro 是对的,我只需要等待。但现在我遇到了另一个问题:

安装需要 30 多分钟!以及大量资源(CPU 和磁盘使用)……难以置信的资源量。 这是 CPU 和 DISK 读/写的图表: 我想这不是正常的行为。有什么想法吗?

谢谢!

【问题讨论】:

    标签: installation laravel-4 ubuntu-12.04 composer-php php


    【解决方案1】:

    这是 Composer 运行缓慢。 您需要等待,是的,可能需要很长时间。

    你也可以尝试一一下载包,“手动”安装 Laravel

    创建你的目录并输入它:

    mkdir /var/www/laravel/ex2/laravel
    cd /var/www/laravel/ex2/laravel
    

    一个一个地下载所有包:

    composer require filp/whoops 1.0.7
    composer require nikic/php-parser dev-master#700847e
    composer require jeremeamia/superclosure 1.0.1
    composer require doctrine/lexer dev-master#bc0e1f0
    composer require doctrine/annotations v1.1.2
    composer require doctrine/collections dev-master#bcb5377
    composer require doctrine/cache v1.3.0
    composer require doctrine/inflector dev-master#8b4b3cc
    composer require doctrine/common dev-master#d9dea98
    composer require doctrine/dbal 2.4.x-dev#9efdbce
    composer require psr/log 1.0.0
    composer require monolog/monolog dev-master#a501075
    composer require symfony/translation 2.3.x-dev#6aedcff
    composer require symfony/routing 2.3.x-dev#7d41463
    composer require symfony/process 2.3.x-dev#8289810
    composer require symfony/debug 2.3.x-dev#085d4fd
    composer require symfony/http-foundation 2.3.x-dev#796619f
    composer require symfony/event-dispatcher 2.3.x-dev#2d8ece3
    composer require symfony/http-kernel 2.3.x-dev#9795c9f
    composer require symfony/finder 2.3.x-dev#a175521
    composer require symfony/dom-crawler 2.3.x-dev#4dc2c59
    composer require symfony/css-selector 2.3.x-dev#8df20c5
    composer require symfony/console 2.3.x-dev#f880062
    composer require symfony/browser-kit 2.3.x-dev#7fc66ea
    composer require symfony/filesystem dev-master#e558fd5
    composer require swiftmailer/swiftmailer v5.0.2
    composer require predis/predis 0.8.x-dev#ff004ae
    composer require patchwork/utf8 v1.1.14
    composer require nesbot/carbon 1.4.0
    composer require ircmaxell/password-compat 1.0.x-dev#1fc1521
    composer require classpreloader/classpreloader 1.0.1
    

    终于下载 Laravel

    composer require laravel/framework 4.0.x-dev
    composer require laravel/laravel 4.0.x
    

    把它移到正确的地方

    mv -f vendor/laravel/laravel/* .
    mv -f vendor/laravel/laravel/.g* .
    rm -rf vendor/laravel/laravel
    

    并执行此操作以修复您的 composer.lock

    composer update
    

    下载软件包后,Composer 会将它们缓存在您的主文件夹中,因此下次安装时您不必手动下载所有软件包,当然,除非更新了一些。

    注意:这仅适用于 Laravel 4.0.9,因为其中一些包被“标记”为下载特定的提交(例如:#700847e)。

    【讨论】:

    • 谢谢。终于发生了:)但这需要30多分钟!以及大量资源(CPU 和磁盘使用)……难以置信的资源量。这是 CPU 和磁盘读/写的图表:dropbox.com/s/gx2excfbae57guo/… 我猜这不是正常行为有什么想法吗?
    • 我现在在 EC2 服务器上为我做同样的事情,现在已经超过 20 分钟。我不习惯作曲家花这么长时间。 :(
    • @Foxinni 您的参考文献:一旦您的项目变得“足够大”,在 EC2 小型和微型实例上部署 composer 会非常缓慢。将实例类型更改为 t3-medium 似乎要快得多。
    • 或者您可以简单地创建vendor 目录的存档并将其上传到您的计算机,而不是使用composer install。我相信这会节省很多时间。 :)
    【解决方案2】:

    确保您没有默认启用 xdebug。如果有,请将其关闭。

    我遇到了类似的问题,加载 JSON 依赖项需要一个小时(对于 Laravel)。关闭 cli 的 xdebug 后,一切都会在几秒钟内加载!

    【讨论】:

    • 正是问题所在(Windows 上的 HP 5.6,Laravel 5 以获取有关我的情况的更多信息),在运行 composer 时从 php.ini 中删除了 xdebug 行,只花了大约 2 分钟。
    【解决方案3】:

    我将它安装在 xampp 目录中的 Windows 机器上,发现它在 Apache 运行时被挂起,当我停止 Apache 时它立即启动并在几秒内结束。

    【讨论】:

    • 这解决了我的问题,我停止了 apache 服务并且它工作不知道为什么。
    【解决方案4】:

    对我来说,作曲家供应商。我刚刚composer -vvv update

    【讨论】:

    • 它实际上并没有挂起,用-vvv命令我们可以看到它正在下载
    【解决方案5】:

    一种可能是你有无法解决的依赖关系:

    您的要求无法解决为一组可安装的 包。

    正如其他人所提到的,您可能只需要运行composer install 并等待。如果无法解决依赖关系,composer 将扫描所有可能的选项 - 这可能需要很长时间。

    如果您有很多依赖项 - 您可能想先尝试从 composer.json 中删除所有内容,然后一次将它们添加回来,以发现哪些无法解决。

    composer install 最终完成时 - 仔细阅读输出,看看是否缺少需要手动安装的依赖项。

    就我而言,我只是想安装一个包。这是我的composer.json

    {
        "require-dev": {
            "phpunit/phpunit": "^8"
    }
    

    composer install跑了好久终于报了:

      Problem 1
    - phpunit/phpunit 8.5.2 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.5.1 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.5.0 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.4.3 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.4.2 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.4.1 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.4.0 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.3.5 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.3.4 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.3.3 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.3.2 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.3.1 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.3.0 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.2.5 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.2.4 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.2.3 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.2.2 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.2.1 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.2.0 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.1.6 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.1.5 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.1.4 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.1.3 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.1.2 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.1.1 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.1.0 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.0.6 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.0.5 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.0.4 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.0.3 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.0.2 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.0.1 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - phpunit/phpunit 8.0.0 requires ext-dom * -> the requested PHP extension dom is missing from your system.
    - Installation request for phpunit/phpunit ^8 -> satisfiable by phpunit/phpunit[8.0.0, 8.0.1, 8.0.2, 8.0.3, 8.0.4, 8.0.5, 8.0.6, 8.1.0, 8.1.1, 8.1.2, 8.1.3, 8.1.4, 8.1.5, 8.1.6, 8.2.0, 8.2.1, 8.2.2, 8.2.3, 8.2.4, 8.2.5, 8.3.0, 8.3.1, 8.3.2, 8.3.3, 8.3.4, 8.3.5, 8.4.0, 8.4.1, 8.4.2, 8.4.3, 8.5.0, 8.5.1, 8.5.2].
    

    所以我安装了缺少的依赖项 - PHP 扩展 dom:

    sudo apt install php-dom
    

    下次我运行composer install时它成功完成了。

    【讨论】:

      【解决方案6】:

      老问题,但我找到了新答案。

      我的php-cli 没有启用php-curl 扩展。

      安装并启用它就可以了。

      【讨论】:

      • 是的,你是对的,这是我在 ubuntu 中遇到的主要问题。谢谢:)
      猜你喜欢
      • 2014-05-26
      • 1970-01-01
      • 2020-12-27
      • 1970-01-01
      • 2015-01-24
      • 1970-01-01
      • 2017-06-28
      • 1970-01-01
      • 2015-10-27
      相关资源
      最近更新 更多