1

您好,我正在尝试通过 composer 安装 behat/behat,但是我遇到了依赖问题。我尝试了以下许多:

composer require behat/behat:"3.*" symfony/dependency-injection:"3.*" --dev

但是,上面的输出是

Your requirements could not be resolved to an installable set of packages.

下面是我的 composer.json 文件。

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.3.*",
        "dingo/api": "1.0.*@dev",
        "tymon/jwt-auth": "0.5.11",
        "phaza/laravel-postgis": "^3.0",
        "jenssegers/raven": "1.9.0",
        "guzzlehttp/guzzle": "~5.3|~6.0",
        "oureastudios/laravel5-braintree": "dev-master",
        "vinkla/algolia": "^2.1",
        "alexpechkarev/google-maps": "1.0.5",
        "pda/pheanstalk": "~3.0",
        "league/flysystem-aws-s3-v3": "~1.0",
        "pubnub/pubnub": "3.7.*",
        "maknz/slack": "^1.7",
        "intervention/image": "^2.3",
        "wilgucki/csv": "^0.5.1",
        "doctrine/dbal": "^2.5",
        "davibennun/laravel-push-notification": "@dev",
        "aloha/twilio": "^2.1",
        "laravel/socialite": "^2.0",
        "barryvdh/laravel-dompdf": "^0.8.0",
        "mockery/mockery": "1.0",
        "maxmind-db/reader": "~1.0",
        "predis/predis": "^1.1"
    },
    "require-dev": {
        "symfony/dom-crawler": "~3.1",
        "symfony/css-selector": "~3.1",
        "fzaninotto/faker": "~1.4",
        "phpunit/phpunit": "~5.0",
        "phpspec/phpspec": "~2.1",
        "johnkary/phpunit-speedtrap": "^1.0",
        "barryvdh/laravel-ide-helper": "^2.4"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php",
            "tests/Helpers/",
            "tests/Traits/"
        ]
    },
    "scripts": {
        "post-install-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "pre-update-cmd": [
            "php artisan clear-compiled",
            "php artisan ide-helper:generate",
            "php artisan ide-helper:models -N",
            "php artisan optimize"
        ],
        "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"
    }
}

我应该安装 behat 和 symfony/dependency-injection 的哪种组合?我尝试了许多版本,曾经发出以下命令 composer info behat/behat -a 但仍然无济于事。

4

1 回答 1

3

基本上,每当您陷入这种依赖关系的噩梦时,强烈建议您将所需的版本具体化,而不是使用通配符。换句话说:给 Composer 更少的想象空间。

这就是我为使其工作所做的工作:

1.猜猜哪个最合适

Laravel 5.3 于2016年 9 月 9 日发布,超过了 Behat版本,之前的第一个主要版本是3.1.0,于 2016 年 3 月 28 日发布。所以这是我直接放入 Composer 的第一个版本(即没有任何通配符等)像这样:

"behat/behat": "3.1.0",

2.运行没有附加条件的东西

之后,我只运行了以下命令:

  • composer dump-autoload: 清理缓存
  • rm -rf vendorrm composer.lock:只是为了让生活更轻松
  • composer install --no-scripts: 只是为了确保那些php artisan东西不会运行。
  • 利润
composer show | grep behat
behat/behat                           v3.1.0               Scenario-oriented BDD framework for PHP 5.3
behat/gherkin                         v4.5.1               Gherkin DSL parser for PHP 5.3
behat/transliterator                  v1.2.0               String transliterator
于 2018-03-19T09:57:19.907 回答