作曲家更新:您的要求无法解决为一组可安装的软件包

Posted

技术标签:

【中文标题】作曲家更新:您的要求无法解决为一组可安装的软件包【英文标题】:composer update: Your requirements could not be resolved to an installable set of packages 【发布时间】:2018-09-16 06:45:17 【问题描述】:

我正在尝试从 laravel 5.5 升级到 5.6。为此,我一直在使用upgrade guide。

首先,我尝试将laravel/framework 更新为5.6.*phpunit/phpunit 更新为~7.0

这会产生错误Your requirements could not be resolved to an installable set of packages.

我明白这意味着什么,但是错误日志真的很难解析,我已经尝试了几个小时来将 composer.json 文件更改为一组可安装的软件包。 我自己没有设法解决这个问题,所以我来找你。也许你们中的一些人实际上喜欢解决这些问题......

所以,我现在的composer.json,在它的所有荣耀中:


    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": 
        "php": ">=7.1",
        "laravel/framework": "5.6.*",
        "jenssegers/rollbar": "^1.4",
        "doctrine/dbal": "~2.3",
        "sensiolabs/security-checker": "^3.0",
        "guzzlehttp/guzzle": "~6.0",
        "mandrill/mandrill": "1.0.*",
        "lcobucci/jwt" : "^3.1",
        "predis/predis": "~1.0"
    ,
    "require-dev": 
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~7.0",
        "phpspec/phpspec": "~4.0",
        "laravel/homestead" : "~4.0",
        "symfony/dom-crawler": "3.1.*",
        "symfony/css-selector": "3.1.*",
        "filp/whoops": "~2.0"
    

以及当前的错误:

➔ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: don't install laravel/framework v5.6.15
    - Conclusion: don't install laravel/framework v5.6.14
    - Conclusion: don't install symfony/process v4.0.7
    - Conclusion: don't install laravel/framework v5.6.13
    - Conclusion: don't install symfony/process v4.0.6
    - Conclusion: don't install symfony/process v4.0.5
    - Conclusion: don't install symfony/process v4.0.4
    - Conclusion: don't install symfony/process v4.0.3
    - Conclusion: don't install symfony/process v4.0.2
    - Installation request for laravel/homestead ~4.0 -> satisfiable by laravel/homestead[v4.0.0, v4.0.1, v4.0.2, v4.0.3, v4.0.4, v4.0.5].
    - Conclusion: don't install symfony/process v4.0.1
    - laravel/framework v5.6.0 requires symfony/process ~4.0 -> satisfiable by symfony/process[v4.0.0, v4.0.1, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7].
    - laravel/framework v5.6.1 requires symfony/process ~4.0 -> satisfiable by symfony/process[v4.0.0, v4.0.1, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7].
    - laravel/framework v5.6.10 requires symfony/process ~4.0 -> satisfiable by symfony/process[v4.0.0, v4.0.1, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7].
    - laravel/framework v5.6.11 requires symfony/process ~4.0 -> satisfiable by symfony/process[v4.0.0, v4.0.1, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7].
    - laravel/framework v5.6.12 requires symfony/process ~4.0 -> satisfiable by symfony/process[v4.0.0, v4.0.1, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7].
    - laravel/framework v5.6.2 requires symfony/process ~4.0 -> satisfiable by symfony/process[v4.0.0, v4.0.1, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7].
    - laravel/framework v5.6.3 requires symfony/process ~4.0 -> satisfiable by symfony/process[v4.0.0, v4.0.1, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7].
    - laravel/framework v5.6.4 requires symfony/process ~4.0 -> satisfiable by symfony/process[v4.0.0, v4.0.1, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7].
    - laravel/framework v5.6.5 requires symfony/process ~4.0 -> satisfiable by symfony/process[v4.0.0, v4.0.1, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7].
    - laravel/framework v5.6.6 requires symfony/process ~4.0 -> satisfiable by symfony/process[v4.0.0, v4.0.1, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7].
    - laravel/framework v5.6.7 requires symfony/process ~4.0 -> satisfiable by symfony/process[v4.0.0, v4.0.1, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7].
    - laravel/framework v5.6.8 requires symfony/process ~4.0 -> satisfiable by symfony/process[v4.0.0, v4.0.1, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7].
    - laravel/framework v5.6.9 requires symfony/process ~4.0 -> satisfiable by symfony/process[v4.0.0, v4.0.1, v4.0.2, v4.0.3, v4.0.4, v4.0.5, v4.0.6, v4.0.7].
    - Conclusion: don't install symfony/process v4.0.0
    - Installation request for laravel/framework 5.6.* -> satisfiable by laravel/framework[v5.6.0, v5.6.1, v5.6.10, v5.6.11, v5.6.12, v5.6.13, v5.6.14, v5.6.15, v5.6.2, v5.6.3, v5.6.4, v5.6.5, v5.6.6, v5.6.7, v5.6.8, v5.6.9].

我真的希望有人能够破译作曲家在这里的意思。我也希望自己也能做到这一点,但似乎这个问题的所有其他解决方案都是专门针对 that composer.json 的,而不是一般的答案..

【问题讨论】:

来自该指南:“Laravel 5.6 需要 PHP 7.1.3 或更高版本。”查看将 "php": ">=7.1", 更改为 "php": "^7.1.3", 是否有帮助 尝试用composer require symfony/process添加symfony/process 同样来自该指南:“Laravel 使用的所有底层 Symfony 组件都已升级到 Symfony ~4.0 版本系列。”您可能应该将所有 Symfony 组件更新为4 rm -rf ./vendor & composer update 如果仍然出现问题,您需要将 PHP 升级到 7.1.14。 我猜你可以在"laravel/framework": "5.6.*", 之前添加"symfony/process": "^4.0" 到你的require 看看会发生什么 【参考方案1】:

对于这种情况,我不得不做以下事情:

我将php 更新为^7.1.3 sensiolabs/security-checker^4.1 phpspec~4.0 laravel/homestead~7.3 symfony/dom-crawlersymfony/css-selector^4.0 删除对 composer optimize 的引用,因为它现在已被删除 停止使用 configureMonologUsing(...) 并为 Rollbar 创建一个自定义记录器类。

感谢 cmets 的所有帮助!

【讨论】:

以上是关于作曲家更新:您的要求无法解决为一组可安装的软件包的主要内容,如果未能解决你的问题,请参考以下文章

我得到“您的要求无法解决为一组可安装的软件包。”当我运行作曲家更新

Composer 更新 - 您的要求无法解析为一组可安装的软件包

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

您的要求无法解析为一组可安装的软件包(Composer 更新)

您的要求无法解决为一组可安装的软件包。在 laravel 8

CakePHP 4.x Authentication 2.x - 安装失败。您的要求无法解决为一组可安装的软件包