1

我正在测试 Laravel Framework 新的 5.1 版本。

我想安装著名的barryvdh/laravel-ide-helper软件包。

A 知道问题是:barryvdh/laravel-ide-helperrequireilluminate/filesystem: 5.0.xlaravel/frameworkrequire illuminate/filesystem: 5.1.x

如何配置我的composer.json文件?

注意:我有"minimum-stability": "dev""prefer-stable": true在我的 composer.json 文件中。

在安装时,我收到此错误:

Problem 1
    - Conclusion: remove laravel/framework 5.1.x-dev
    - barryvdh/laravel-ide-helper 2.0.x-dev requires illuminate/filesystem 5.0.x -> satisfiable by illuminate/filesystem[5.0.x-dev, v5.0.0, v5.0.22, v5.0.25, v5.0.26, v5.0.28, v5.0.4].
    - barryvdh/laravel-ide-helper v2.0.0 requires illuminate/filesystem 5.0.x -> satisfiable by illuminate/filesystem[5.0.x-dev, v5.0.0, v5.0.22, v5.0.25, v5.0.26, v5.0.28, v5.0.4].
    - barryvdh/laravel-ide-helper v2.0.1 requires illuminate/filesystem 5.0.x -> satisfiable by illuminate/filesystem[5.0.x-dev, v5.0.0, v5.0.22, v5.0.25, v5.0.26, v5.0.28, v5.0.4].
    - barryvdh/laravel-ide-helper v2.0.2 requires illuminate/filesystem 5.0.x -> satisfiable by illuminate/filesystem[5.0.x-dev, v5.0.0, v5.0.22, v5.0.25, v5.0.26, v5.0.28, v5.0.4].
    - barryvdh/laravel-ide-helper v2.0.3 requires illuminate/filesystem 5.0.x -> satisfiable by illuminate/filesystem[5.0.x-dev, v5.0.0, v5.0.22, v5.0.25, v5.0.26, v5.0.28, v5.0.4].
    - don't install illuminate/filesystem 5.0.x-dev|don't install laravel/framework 5.1.x-dev
    - don't install illuminate/filesystem v5.0.0|don't install laravel/framework 5.1.x-dev
    - don't install illuminate/filesystem v5.0.22|don't install laravel/framework 5.1.x-dev
    - don't install illuminate/filesystem v5.0.25|don't install laravel/framework 5.1.x-dev
    - don't install illuminate/filesystem v5.0.26|don't install laravel/framework 5.1.x-dev
    - don't install illuminate/filesystem v5.0.28|don't install laravel/framework 5.1.x-dev
    - don't install illuminate/filesystem v5.0.4|don't install laravel/framework 5.1.x-dev
    - Installation request for laravel/framework 5.1.* -> satisfiable by laravel/framework[5.1.x-dev].
    - Installation request for barryvdh/laravel-ide-helper ^2.0@dev -> satisfiable by barryvdh/laravel-ide-helper[2.0.x-dev, v2.0.0, v2.0.1, v2.0.2, v2.0.3].

我已经尝试了以下所有命令,结果相同...

$ composer require barryvdh/laravel-ide-helper,
$ composer require barryvdh/laravel-ide-helper:@dev --dev
$ composer require barryvdh/laravel-ide-helper --dev --update-with-dependencies

我还尝试在composer.json文件中创建一个别名:

"require": {
    "laravel/framework": "5.1.*",
    "illuminate/filesystem": "5.1.x-dev as 5.0.28"
},

然后出现这个错误:

  Problem 1
    - Installation request for barryvdh/laravel-ide-helper dev-master -> satisfiable by barryvdh/laravel-ide-helper[dev-master].
    - Conclusion: remove laravel/framework 5.1.x-dev
    - Conclusion: don't install laravel/framework 5.1.x-dev
    - barryvdh/laravel-ide-helper dev-master requires illuminate/filesystem 5.0.x -> satisfiable by illuminate/filesystem[5.0.x-dev, 5.0.28].
    - don't install illuminate/filesystem 5.0.x-dev|don't install laravel/framework 5.1.x-dev
    - don't install illuminate/filesystem 5.0.28|don't install laravel/framework 5.1.x-dev
    - Installation request for laravel/framework 5.1.* -> satisfiable by laravel/framework[5.1.x-dev].

这是我的composer.json文件:

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "laravel/framework": "5.1.*",
        "illuminate/filesystem": "5.1.x-dev as 5.0.28"
    },
    "require-dev": {
        "phpunit/phpunit": "~4.0",
        "phpspec/phpspec": "~2.1"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "Portal\\": "app/"
        }
    },
    "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"
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}
4

3 回答 3

0

核心问题源于对5.0.x. 我不知道这是否有充分的理由。

一种选择是 forklaravel-ide-helper到您自己的 repo,将版本约束更改为类似^5.0(可能还有包名称),然后将您的 fork repo 作为 git 存储库添加到您的composer.json文件中。这将使您至少可以查看它是否按预期工作。

于 2015-05-03T05:47:31.877 回答
0

正如您所指出的,问题是您安装了 Laravel 5.1(顺便说一句,它仍然不稳定,我不建议在 atm 使用它)并且该软件包需要 5.0.*。

有几个解决方案:

  • 在 laravel ide helper 仓库中创建一个 issue,要求作者放宽版本约束。请注意,这个库与版本密切相关,这可能是版本约束如此严格的原因。
  • 不要安装不稳定的 5.1 版本,而是坚持 5.0 并在发布和更新包时使用 5.1。
于 2015-05-03T11:34:47.007 回答
0

我已经解决了我的composer.json文件中的一个别名:

"require": {
    "laravel/framework": "5.1.x-dev as 5.0.28"
},

所以,laravel/framework 有"illuminate/filesystem": "5.1.x-dev"并且barryvdh/laravel-ide-helper认为有"illuminate/filesystem": "5.0.28"

我的第一种方法:

"require": {
    "laravel/framework": "5.1.*",
    "illuminate/filesystem": "5.1.x-dev as 5.0.28"
},

它不起作用,因为illuminate/filesystem它被用作子树laravel/framework,然后我必须设置别名laravel/framework而不是illuminate/filesystem.

于 2015-05-03T13:55:44.930 回答