安装Sonata News Bundle composer错误

时间:2016-10-23 17:51:22

标签: symfony composer-php sonata

我正在尝试使用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 个答案:

答案 0 :(得分:0)

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

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

分类和简易扩展已经被捆绑包自动要求,因此您实际上需要这样做:composer require sonata-project/news-bundle sonata-project/doctrine-orm-admin-bundle

更新:此处为my PR