解决依赖冲突安装Behat和Laravel 5.3

时间:2018-03-19 09:38:12

标签: composer-php behat symfony-dependency-injection

您好我正在尝试通过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的组合?我尝试了许多版本以下发出的命令 作曲家信息behat / behat -a但仍然无济于事。

1 个答案:

答案 0 :(得分:3)

基本上,每当您遇到此依赖性噩梦时,强烈建议您使用所需的特定版本而不是通配符。换句话说:给予Composer更少的想象空间。

这就是我做的工作:

1。猜猜哪个最合适

Laravel 5.3于2016年9月9日回归released,超过了Behat releases,这是2016年3月28日发布的第一个主要版本3.1.0。所以这是我在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