依赖地狱:安装 Sonata User

dependency hell: installing Sonata User

大家好,恐怕又一个新手被困在试图将所有部分粘合在一起。至少可以说,这相当令人沮丧:(

我搜索了这些论坛,看到了无数可能的解决方案,但 none 到目前为止都有效。大多数也很旧,并且版本已经更新。

开始吧:

https://sonata-project.org/bundles/user/2-2/doc/reference/installation.html

当我尝试这个时:composer require sonata-project/easy-extends-bundle

我明白了:

Using version ^2.1 for sonata-project/easy-extends-bundle ./composer.json has been updated 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 - The requested package sonata-project/admin-bundle == 2.3.7.0 could not be found. Problem 2 - Can only install one of: sonata-project/block-bundle[2.3.8, 2.2.13]. - Can only install one of: sonata-project/block-bundle[2.3.8, 2.2.13]. - Can only install one of: sonata-project/block-bundle[2.3.8, 2.2.13]. - sonata-project/admin-bundle dev-master requires sonata-project/block-bundle ^2.3.8 -> satisfiable by sonata-project/block-bundle[2.3.8]. - Installation request for sonata-project/admin-bundle dev-master -> satisfiable by sonata-project/admin-bundle[dev-master]. - Installation request for sonata-project/block-bundle == 2.2.13.0 -> satisfiable by sonata-project/block-bundle[2.2.13].

Potential causes:- A typo in the package name - The package is not available in a stable-enough version according to your minimum-stability setting

Installation failed, reverting ./composer.json to its original content.

我只是按照说明操作,简单明了!我阅读了那些文章,并在这里尝试了一些解决方案,并通过 Google 搜索。

无论如何,我是一个老 Unix 黑客,我不记得开源构建这么难......

有线索吗?非常感谢!

p.s。我正在使用 Debian 虚拟机,因为我认为它比在我的 Windows 8 PC 上尝试更容易。

这是 composer.json 中唯一更改的部分:

"require": {
    "php": ">=5.3.9",
    "symfony/symfony": "2.7.*",
    "doctrine/orm": "~2.2,>=2.2.3,<2.5",
    "doctrine/dbal": "<2.5",
    "doctrine/doctrine-bundle": "~1.4",
    "symfony/assetic-bundle": "~2.3",
    "symfony/swiftmailer-bundle": "~2.3",
    "symfony/monolog-bundle": "~2.4",
    "sensio/distribution-bundle": "~4.0",
    "sensio/framework-extra-bundle": "~3.0,>=3.0.2",
    "incenteev/composer-parameter-handler": "~2.0",
    "friendsofsymfony/user-bundle": "~2.0@dev",
    "sonata-project/admin-bundle": "2.3.*",
    "sonata-project/doctrine-orm-admin-bundle": "^2.3",
    "sonata-project/easy-extends-bundle": "^2.1",
    "sonata-project/user-bundle": "^2.2",
    "sonata-project/easy-extends-bundle": "dev-master"
},

1.清空vendor文件夹:删除里面的所有东西,但不要删除它自己。可能是下载的依赖项损坏导致您出现问题。

2. 用这个替换 composer.jsonrequire 部分:

"require": {
    "php": ">=5.3.9",
    "symfony/symfony": "2.7.*",
    "doctrine/orm": "~2.2,>=2.2.3,<2.5",
    "doctrine/dbal": "<2.5",
    "doctrine/doctrine-bundle": "~1.4",
    "symfony/assetic-bundle": "~2.3",
    "symfony/swiftmailer-bundle": "~2.3",
    "symfony/monolog-bundle": "~2.4",
    "sensio/distribution-bundle": "~4.0",
    "sensio/framework-extra-bundle": "~3.0,>=3.0.2",
    "incenteev/composer-parameter-handler": "~2.0",
    "friendsofsymfony/user-bundle": "~1.3",
    "sonata-project/admin-bundle": "2.3.*",
    "sonata-project/doctrine-orm-admin-bundle": "^2.3",
    "sonata-project/easy-extends-bundle": "^2.1",
    "sonata-project/user-bundle": "^2.2"
},

请注意 "friendsofsymfony/user-bundle" 版本的差异。

现在应该可以了!让我知道它是否仍然给您带来问题。