Laravel composer install hangs on “Installing dependencies” and consume a lot of resources (CPU, DISK)

柔情痞子 提交于 2019-12-10 02:51:57

问题


Problem 1:

I tried install laravel 4 on my server (Ubuntu 12.04, nginx, php5-fpm) but installation hangs:

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

- no errors, no nothing, it's just hangs and that's all. I've tried installation using composer create-project laravel/laravel --prefer-dist ...and result was pretty the same:

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)

I couldn't find any ideas/solutions.

Could anyone please tell me what is the problem and how could I fix it?

Problem 2:

@antonio-carlos-ribeiro was right, I just need to wait. But now I've got another problem:

Installation takes more than 30 minutes! And a lot of resources (CPU and DISK usage)... unbelievable amount of resources. Here is graphs of CPU and DISK read/write:

I guess it's not normal behavior. Any ideas what is going on?

Thanks!


回答1:


This is Composer being slow. You need to wait for it and, yeah, it may be a lot of time.

You also can try to download the packages one by one, installing Laravel "manually"

Create your directory and enter it:

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

Dowload all packages ony by one:

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

Finally download Laravel

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

Move it to the right place

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

And execute this to fix your composer.lock

composer update

After downloading the packages, Composer will cache them in your home folder, so next install you don't have to download all of them manually, unless, of course, some are updated.

Note: this is will work only for Laravel 4.0.9, since some of those packages are "marked" to download an specific commit (example: #700847e).




回答2:


I was installing it on a windows machine in xampp directory and found that it was hanged while the Apache was running and when i stopped the Apache it starts immediately and ends in some in secs.




回答3:


Make sure you are not having xdebug enabled by default. If you have, turn it off.

I had the similar problem where loading JSON dependencies took an hour (for Laravel). After turning off xdebug for cli everything loads in several seconds!




回答4:


For me was composer vendor. I did just composer -vvv update



来源:https://stackoverflow.com/questions/19825227/laravel-composer-install-hangs-on-installing-dependencies-and-consume-a-lot-of

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!