Composer 安装/更新停止工作
Posted
技术标签:
【中文标题】Composer 安装/更新停止工作【英文标题】:Composer Install/Update stopped working 【发布时间】:2016-03-08 07:18:45 【问题描述】:我的 Composer 突然停止工作。
每当我运行composer update
时,它都不会在此之后继续:
使用包信息加载作曲家存储库 更新依赖(包括require-dev)
我尝试了另一个 Laravel 项目,该项目的 Composer 正在运行
我清除了缓存,也运行了这个命令rm -rf ~/.composer/cache
似乎什么都没有发生。我将composer.lock
移动到另一个文件夹,从当前项目中删除并再次运行命令,但没有运气
这是我的composer.json
文件:
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require":
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"nesbot/carbon": "~1.14",
"venturecraft/revisionable": "~1.8",
"doctrine/dbal": "v2.4.2",
"zizaco/entrust": "dev-laravel-5",
"aws/aws-sdk-php-laravel": "~3.0",
"guzzlehttp/guzzle": "~5.2",
"league/flysystem-aws-s3-v2": "~1.0",
"sofa/revisionable": "~1.0@dev",
"maatwebsite/excel": "~2.0.0",
"monolog/monolog": "^1.15",
"jenssegers/agent": "^2.2",
"php-mime-mail-parser/php-mime-mail-parser": "^2.1",
"messaged/php-mime-mail-parser": "^1.0",
"willdurand/email-reply-parser": "^2.4",
"barryvdh/laravel-debugbar": "~2.0.2"
,
"require-dev":
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1"
,
"autoload":
"classmap": [
"database"
],
"psr-4":
"App\\": "app/",
"Validations\\": "app/Validations"
,
"files": [
"app/Support/helpers.php"
]
,
"autoload-dev":
"classmap": [
"tests/TestCase.php"
]
,
"scripts":
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-create-project-cmd": [
"php -r \"copy('.env.example', '.env');\"",
"php artisan key:generate"
]
,
"config":
"preferred-install": "dist"
【问题讨论】:
这一步通常需要一些时间Updating dependencies (including require-dev)
你给了它一分钟还是三分钟?如果你运行composer install
而不是更新会发生什么?
我同意 Peh 的观点——给它更多的时间。如果你给它足够的时间,它会显示错误或工作。
我等了 20 分钟。同样的两行,没有别的。没有错误,没有进展。
并且已经尝试过 composer install -v 和 composer install。就这两条线。安装而不是更新。
你能尝试在另一台机器上为这个项目运行 composer 吗?我提取了您的 composer.json 文件,不得不摆脱 App\Validations psr-4 调用和 app/support/helpers 文件调用以及 TestCase 类映射,因为我的机器上没有它们......但是,当我运行了安装我得到了这个错误:devimg.next-www.com/20151203105910-001.png你的机器上安装了 ext-mailparse 吗?
【参考方案1】:
我做了一些测试,看起来这两个包结合会导致问题:
"aws/aws-sdk-php-laravel": "~3.0",
"league/flysystem-aws-s3-v2": "~1.0",
它们各自正确安装,但不是一起安装。我使用全新的 Laravel 5.1 安装进行测试 (composer create-project laravel/laravel --prefer-dist
)。仅将这两个包添加到composer.json
Composer 后卡在
更新依赖(包括require-dev)
如果您删除其中一个,您的composer update
运行良好。我对这两个包一无所知,但即使在-verbose
模式下,组合也肯定会使 Composer 崩溃。
以崩溃的composer.json
为例:
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require":
"php": ">=5.5.9",
"laravel/framework": "5.1.*",
"aws/aws-sdk-php-laravel": "~3.0",
"league/flysystem-aws-s3-v2": "~1.0"
,
"require-dev":
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~4.0",
"phpspec/phpspec": "~2.1"
,
"autoload":
"classmap": [
"database"
],
"psr-4":
"App\\": "app/",
"Validations\\": "app/Validations"
,
"autoload-dev":
"classmap": [
"tests/TestCase.php"
]
,
"scripts":
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"pre-update-cmd": [
"php artisan clear-compiled"
],
"post-update-cmd": [
"php artisan optimize"
],
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
]
,
"config":
"preferred-install": "dist"
【讨论】:
是的,我删除了“league/flysystem-aws-s3-v2”:“~1.0”,它起作用了。非常感谢。以上是关于Composer 安装/更新停止工作的主要内容,如果未能解决你的问题,请参考以下文章