我如何解决“无法将您的要求解析为一组可安装的软件包"?错误? [英] How can I resolve "Your requirements could not be resolved to an installable set of packages" error?

查看:21
本文介绍了我如何解决“无法将您的要求解析为一组可安装的软件包"?错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行 composer update 时,我会收到一些有线输出.

When I run composer update I receive some wired output.

这是我的 composer.json 的样子.

Here is my composer.json look like.

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.", "keywords": ["framework", "laravel"],
    "license": "MIT",
    "repositories": [{
        "type": "vcs",
        "url": "https://github.com/Zizaco/ardent.git"
    }],
    "require-dev": {
        "phpunit/phpunit": "4.3.*"
    },
    "require": {
        "laravel/framework": "4.2.*", 
        "laravelbook/ardent": "dev-master as 2.4.0", 
        "zizaco/entrust": "dev-master", 
        "sebklaus/profiler": "dev-master", 
        "doctrine/dbal": "dev-master"
    },
    "autoload": {
        "classmap": [
            "app/commands",
            "app/controllers",
            "app/models",
            "app/database/migrations", "app/database/seeds", "app/tests",
            "app/libraries"
        ]
    },
    "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 artisan key:generate"
        ]
    },
    "config": {
        "preferred-install": "dist"
    },
    "minimum-stability": "stable"
}

我该如何解决?

推荐答案

您的软件依赖项存在不兼容的版本冲突.

Your software dependencies have an incompatible version conflict.

同时你想安装任何 Laravel 4.2.x 版本,并从它的 master 分支安装zizaco/entrust".而那个 master 分支至少需要 Laravel 5.0(粗略地说).

At the same time you want to install any Laravel 4.2.x version, and "zizaco/entrust" from its master branch. And that master branch requires at least Laravel 5.0 (roughly speaking).

问题来自于对分支的依赖.很可能 zizaco/entrust 包曾经在其 master 分支中使用 Laravel 4.2,并且您可以在那天安装您的依赖项.但是,当此分支因版本要求不兼容而更新时,您将永远无法运行 composer update 并获得更新的依赖项.

The problem comes from the dependency on branches. It's likely that the package zizaco/entrust once was using Laravel 4.2 in its master branch, and that you were able to install your dependencies at that day. But the very moment this branch gets updated with an incompatible version requirement, you will never ever be able to run composer update and get updated dependencies.

始终使用标记版本!理想情况下,您使用允许兼容更新的宽松版本要求.这应该表示为波浪号两个数字版本要求:~1.2 将安装 1.2.0 及更高版本(如 1.2.99 或 1.2.100),以及 1.3 及更高版本.如果您需要某个补丁版本:Caret-three-number version ^1.2.10 将安装 1.2.10 或更高版本,也将安装 1.3 及更高版本.

Always use tagged versions! Ideally you use a relaxed version requirement that allows for compatible updates. This should be expressed as a tilde-two-number version requirement: ~1.2 would install a version 1.2.0 and up (like 1.2.99 or 1.2.100), and also 1.3 and up. If you need a certain patch release: Caret-three-number version ^1.2.10 will install 1.2.10 or up, also 1.3 and up.

使用此版本要求而不是 dev-master 将允许您使用已发布版本而不是 master 分支中的不稳定状态,并允许您解决仍可与 Laravel 一起使用的最新版本4.2.我想这将是 zizaco/entrust 1.3.0 版,但 1.2 版也符合条件.使用 "zizaco/entrust": "~1.2".

Using this version requirement instead of dev-master will allow you to use released versions instead of the unstable state in the master branch, and allows you to address the most recent version that still works with Laravel 4.2. I guess that would be zizaco/entrust version 1.3.0, but version 1.2 would also qualify. Go with "zizaco/entrust": "~1.2".

这篇关于我如何解决“无法将您的要求解析为一组可安装的软件包"?错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆