安装奏鸣曲新闻捆绑作曲家错误

Posted

技术标签:

【中文标题】安装奏鸣曲新闻捆绑作曲家错误【英文标题】:Install Sonata News Bundle composer error 【发布时间】:2017-03-05 12:00:17 【问题描述】:

我正在尝试使用 sonata-project/new-bundle。

我首先创建一个全新的 symfony 2.8 项目。

我关注后,官网安装指南

https://sonata-project.org/bundles/news/master/doc/reference/installation.html

我运行这些命令

composer require sonata-project/news-bundle "dev-master" --no-update
composer require sonata-project/doctrine-orm-admin-bundle "dev-master" --no-update
composer require sonata-project/easy-extends-bundle "dev-master" --no-update
composer require friendsofsymfony/rest-bundle "~1.1" --no-update
composer require nelmio/api-doc-bundle "~0.1|~1.0" --no-update
composer require sonata-project/classification-bundle "~2.2@dev"

但我的控制台中有这些错误:/

./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
    - Installation request for sonata-project/news-bundle dev-master -> satisfiable by sonata-project/news-bundle[dev-master].
    - sonata-project/doctrine-orm-admin-bundle dev-master conflicts with sonata-project/news-bundle[dev-master].
    - Installation request for sonata-project/doctrine-orm-admin-bundle dev-master -> satisfiable by sonata-project/doctrine-orm-admin-bundle[dev-master].


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

怎么了?

感谢您的回复。

【问题讨论】:

【参考方案1】:

在任何地方都使用dev-master 是错误的。你永远不应该那样做。我看到这就是文档中所写的内容,所以我会做一个 PR 来改变它,很抱歉你必须阅读它。

IMO,你最好的选择是让 Composer 选择它应该使用的版本,而不是限制它:

composer require sonata-project/news-bundle sonata-project/doctrine-orm-admin-bundle  sonata-project/easy-extends-bundle friendsofsymfony/rest-bundle nelmio/api-doc-bundle sonata-project/classification-bundle
Using version ^3.0 for sonata-project/news-bundle
Using version ^3.1 for sonata-project/doctrine-orm-admin-bundle
Using version ^2.1 for sonata-project/easy-extends-bundle
Using version ^2.1 for friendsofsymfony/rest-bundle
Using version ^2.13 for nelmio/api-doc-bundle
Using version ^3.1 for sonata-project/classification-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
    - sonata-project/user-bundle 3.0.1 requires friendsofsymfony/rest-bundle ^1.1 -> satisfiable by friendsofsymfony/rest-bundle[1.1.0, 1.2.0, 1.2.1, 1.2.2, 1.3.0, 1.3.1, 1.4.0, 1.4.0-RC1, 1.4.1, 1.4.2, 1.5.0, 1.5.0-RC1, 1.5.0-RC2, 1.5.0-RC3, 1.5.0-RC4, 1.5.0-RC5, 1.5.1, 1.5.2, 1.5.3, 1.5.x-dev, 1.6.0, 1.6.0-RC1, 1.6.0-RC2, 1.6.1, 1.7.0, 1.7.1, 1.7.2, 1.7.3, 1.7.4, 1.7.6, 1.7.7, 1.7.8, 1.7.9, 1.7.x-dev, 1.8.0, 1.8.0-BETA1, 1.8.0-BETA2, 1.8.x-dev] but these conflict with your requirements or minimum-stability.
    - sonata-project/user-bundle 3.0.0 requires friendsofsymfony/rest-bundle ^1.1 -> satisfiable by friendsofsymfony/rest-bundle[1.1.0, 1.2.0, 1.2.1, 1.2.2, 1.3.0, 1.3.1, 1.4.0, 1.4.0-RC1, 1.4.1, 1.4.2, 1.5.0, 1.5.0-RC1, 1.5.0-RC2, 1.5.0-RC3, 1.5.0-RC4, 1.5.0-RC5, 1.5.1, 1.5.2, 1.5.3, 1.5.x-dev, 1.6.0, 1.6.0-RC1, 1.6.0-RC2, 1.6.1, 1.7.0, 1.7.1, 1.7.2, 1.7.3, 1.7.4, 1.7.6, 1.7.7, 1.7.8, 1.7.9, 1.7.x-dev, 1.8.0, 1.8.0-BETA1, 1.8.0-BETA2, 1.8.x-dev] but these conflict with your requirements or minimum-stability.
    - Installation request for sonata-project/news-bundle ^3.0 -> satisfiable by sonata-project/news-bundle[3.0.0].
    - friendsofsymfony/rest-bundle 2.1.0 conflicts with sonata-project/user-bundle[3.1.0].
    - sonata-project/news-bundle 3.0.0 requires sonata-project/user-bundle ^3.0 -> satisfiable by sonata-project/user-bundle[3.0.0, 3.0.1, 3.1.0].
    - Installation request for friendsofsymfony/rest-bundle ^2.1 -> satisfiable by friendsofsymfony/rest-bundle[2.1.0].

文档说“仅当您使用 API 时才需要friendsofsymfony/rest-bundle 和 nelmio/api-doc-bundle。”所以假设你没有:

composer require sonata-project/news-bundle sonata-project/doctrine-orm-admin-bundle  sonata-project/easy-extends-bundle sonata-project/classification-bundle 
Using version ^3.0 for sonata-project/news-bundle
Using version ^3.1 for sonata-project/doctrine-orm-admin-bundle
Using version ^2.1 for sonata-project/easy-extends-bundle
Using version ^3.1 for sonata-project/classification-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing twig/twig (v1.26.1)
    Loading from cache

  - Installing symfony/polyfill-mbstring (v1.2.0)
    Loading from cache

  - Installing psr/log (1.0.2)
    Loading from cache

  - Installing doctrine/lexer (v1.0.1)
    Loading from cache

  - Installing doctrine/inflector (v1.1.0)
    Loading from cache

  - Installing doctrine/collections (v1.3.0)
    Loading from cache

  - Installing doctrine/cache (v1.6.0)
    Loading from cache

  - Installing doctrine/annotations (v1.2.7)
    Loading from cache

  - Installing doctrine/common (v2.6.1)
    Loading from cache

  - Installing symfony/polyfill-apcu (v1.2.0)
    Loading from cache

  - Installing symfony/security-acl (v3.0.0)
    Loading from cache

  - Installing symfony/symfony (v2.8.12)
    Downloading: 100%         

  - Installing symfony/polyfill-php54 (v1.2.0)
    Loading from cache

  - Installing symfony/polyfill-intl-icu (v1.2.0)
    Loading from cache

  - Installing symfony/polyfill-util (v1.2.0)
    Loading from cache

  - Installing paragonie/random_compat (v2.0.3)
    Downloading: 100%         

  - Installing symfony/polyfill-php70 (v1.2.0)
    Loading from cache

  - Installing symfony/polyfill-php56 (v1.2.0)
    Loading from cache

  - Installing ircmaxell/password-compat (v1.0.4)
    Loading from cache

  - Installing symfony/polyfill-php55 (v1.2.0)
    Loading from cache

  - Installing cocur/slugify (v2.3)
    Loading from cache

  - Installing sonata-project/core-bundle (3.1.1)
    Loading from cache

  - Installing sonata-project/datagrid-bundle (2.2)
    Loading from cache

  - Installing sonata-project/intl-bundle (2.2.4)
    Loading from cache

  - Installing sonata-project/easy-extends-bundle (2.1.10)
    Loading from cache

  - Installing sonata-project/cache (1.0.7)
    Loading from cache

  - Installing sonata-project/block-bundle (3.2.0)
    Downloading: 100%         

  - Installing egeloen/json-builder (2.0.1)
    Loading from cache

  - Installing egeloen/ckeditor-bundle (4.0.5)
    Downloading: 100%         

  - Installing michelf/php-markdown (1.6.0)
    Loading from cache

  - Installing knplabs/knp-markdown-bundle (1.5.1)
    Loading from cache

  - Installing sonata-project/formatter-bundle (3.0.1)
    Loading from cache

  - Installing twig/extensions (v1.4.0)
    Downloading: 100%         

  - Installing sonata-project/exporter (1.7.0)
    Loading from cache

  - Installing knplabs/knp-menu (2.2.0)
    Downloading: 100%         

  - Installing knplabs/knp-menu-bundle (2.1.3)
    Downloading: 100%         

  - Installing sonata-project/admin-bundle (3.9.0)
    Downloading: 100%         

  - Installing doctrine/instantiator (1.0.5)
    Loading from cache

  - Installing doctrine/dbal (v2.5.5)
    Loading from cache

  - Installing doctrine/orm (v2.5.5)
    Loading from cache

  - Installing sonata-project/doctrine-orm-admin-bundle (3.1.1)
    Downloading: 100%         

  - Installing sonata-project/classification-bundle (3.1.0)
    Loading from cache

  - Installing phpoption/phpoption (1.5.0)
    Loading from cache

  - Installing phpcollection/phpcollection (0.5.0)
    Loading from cache

  - Installing jms/parser-lib (1.0.0)
    Loading from cache

  - Installing jms/metadata (1.5.1)
    Loading from cache

  - Installing jms/serializer (1.3.1)
    Loading from cache

  - Installing jms/serializer-bundle (1.1.0)
    Loading from cache

  - Installing kriswallsmith/buzz (v0.15)
    Loading from cache

  - Installing imagine/imagine (v0.6.3)
    Loading from cache

  - Installing knplabs/gaufrette (0.2.1)
    Loading from cache

  - Installing sonata-project/doctrine-extensions (1.0.2)
    Loading from cache

  - Installing zendframework/zenddiagnostics (v1.0.9)
    Loading from cache

  - Installing sonata-project/notification-bundle (3.0.0)
    Loading from cache

  - Installing sonata-project/media-bundle (3.3.0)
    Downloading: 100%         

  - Installing sonata-project/google-authenticator (1.0.2)
    Loading from cache

  - Installing friendsofsymfony/user-bundle (v1.3.6)
    Loading from cache

  - Installing sonata-project/user-bundle (3.1.0)
    Downloading: 100%         

  - Installing sonata-project/news-bundle (3.0.0)
    Downloading: 100%         

paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)
sonata-project/cache suggests installing doctrine/phpcr-odm (PHPCR ODM support)
sonata-project/cache suggests installing ext-memcached (Caching with ext/memcached)
sonata-project/cache suggests installing predis/predis (Install redis php)
sonata-project/block-bundle suggests installing sonata-project/cache-bundle (^3.0)
egeloen/ckeditor-bundle suggests installing egeloen/form-extra-bundle (Allows to load CKEditor asynchronously)
knplabs/knp-markdown-bundle suggests installing ext-sundown (to use optional support for php-sundown extension instead of php implementation)
sonata-project/exporter suggests installing propel/propel1 (^1.6)
knplabs/knp-menu suggests installing pimple/pimple (for the built-in implementations of the menu provider and renderer provider)
knplabs/knp-menu suggests installing silex/silex (for the integration with your silex application)
sonata-project/admin-bundle suggests installing jms/di-extra-bundle (Annotations for Admin definition)
sonata-project/admin-bundle suggests installing jms/translation-bundle (Extract message keys from Admins)
sonata-project/admin-bundle suggests installing sensio/generator-bundle (Add sonata:admin:generate command)
sonata-project/doctrine-orm-admin-bundle suggests installing simplethings/entity-audit-bundle (If you want to support for versioning of entities and their associations.)
jms/serializer-bundle suggests installing jms/di-extra-bundle (Required to get lazy loading (de)serialization visitors, ~1.3)
imagine/imagine suggests installing ext-imagick (to use the Imagick implementation)
imagine/imagine suggests installing ext-gmagick (to use the Gmagick implementation)
knplabs/gaufrette suggests installing amazonwebservices/aws-sdk-for-php (to use the legacy Amazon S3 adapters)
knplabs/gaufrette suggests installing aws/aws-sdk-php (to use the Amazon S3 adapter)
knplabs/gaufrette suggests installing dropbox-php/dropbox-php (to use the Dropbox adapter)
knplabs/gaufrette suggests installing google/apiclient (to use GoogleCloudStorage adapter)
knplabs/gaufrette suggests installing herzult/php-ssh (to use SFtp adapter)
knplabs/gaufrette suggests installing knplabs/knp-gaufrette-bundle (to use with Symfony2)
knplabs/gaufrette suggests installing microsoft/windowsazure (to use Microsoft Azure Blob Storage adapter)
knplabs/gaufrette suggests installing phpseclib/phpseclib (to use PhpseclibSftp adapter)
knplabs/gaufrette suggests installing rackspace/php-opencloud (to use Opencloud adapter)
zendframework/zenddiagnostics suggests installing sensiolabs/security-checker (Required by Check\SecurityAdvisory)
zendframework/zenddiagnostics suggests installing guzzle/http (Required by Check\GuzzleHttpService)
zendframework/zenddiagnostics suggests installing predis/predis (Required by Check\Redis)
zendframework/zenddiagnostics suggests installing videlalvaro/php-amqplib (Required by Check\RabbitMQ)
zendframework/zenddiagnostics suggests installing doctrine/migrations (Required by Check\DoctrineMigration)
sonata-project/notification-bundle suggests installing guzzle/guzzle (^3.9)
sonata-project/notification-bundle suggests installing liip/monitor-bundle (^1.0)
sonata-project/notification-bundle suggests installing videlalvaro/php-amqplib (^2.0)
sonata-project/media-bundle suggests installing liip/imagine-bundle (^0.9)
sonata-project/media-bundle suggests installing rackspace/php-opencloud (^1.6)
sonata-project/media-bundle suggests installing sonata-project/seo-bundle (^2.0)
sonata-project/media-bundle suggests installing tilleuls/ckeditor-sonata-media-bundle (^1.0)
friendsofsymfony/user-bundle suggests installing willdurand/propel-typehintable-behavior (Needed when using the propel implementation)
sonata-project/user-bundle suggests installing friendsofsymfony/rest-bundle (For using the public API methods.)
sonata-project/user-bundle suggests installing nelmio/api-doc-bundle (For using the public API methods.)
sonata-project/user-bundle suggests installing sonata-project/seo-bundle (For SEO breadcrumb block service usage)
Writing lock file
Generating autoload files

bundle 已经自动要求分类和简单扩展,所以您实际上只需要这样做:composer require sonata-project/news-bundle sonata-project/doctrine-orm-admin-bundle

更新:这里是my PR

【讨论】:

以上是关于安装奏鸣曲新闻捆绑作曲家错误的主要内容,如果未能解决你的问题,请参考以下文章

Sonata Bundle 之间的依赖关系

配置文件编辑时奏鸣曲用户捆绑错误

依赖问题作曲家[奏鸣曲管理员; SonataDoctrineORMAdminBundle]

SonataPageBundle 没有为矩阵区域“标题”定义容器

作曲家无法加载包无效的版本字符串

Sonata 产品列表错误(Sonata E-Commerce Bundle)