Search code examples
phpzend-framework

Problem 1 - Conclusion: don't install zendframework/zend-cache


I'm create one project...

 php composer.phar create-project -sdev zendframework/skeleton-application zf3-helloworld 
 cd zf3-helloworld/
 cp composer.phar zf3-helloworld/
 cd zf3-helloworld/

 php composer.phar update

I'm use PHP7.2

I installed several packages without problems, however try to install the package zendframework / zend-cache, I get the error:

Using version ^2.8 for zendframework/zend-cache
./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
    - Conclusion: don't install zendframework/zend-cache 2.8.2
    - Conclusion: don't install zendframework/zend-cache 2.8.1
    - Conclusion: don't install zendframework/zend-cache 2.8.0
    - Conclusion: don't install zendframework/zend-cache 2.9.x-dev
    - Conclusion: remove zendframework/zend-eventmanager 3.1.0
    - Installation request for zendframework/zend-cache ^2.8 -> satisfiable by zendframework/zend-cache[2.8.0, 2.8.1, 2.8.2, 2.9.x-dev, 2.8.x-dev].
    - Conclusion: don't install zendframework/zend-eventmanager 3.1.0
    - zendframework/zend-cache 2.8.x-dev requires zendframework/zend-eventmanager ^2.6.3 || ^3.2 -> satisfiable by zendframework/zend-eventmanager[2.6.3, 2.6.4, 3.2.0, 3.2.1, 3.3.x-dev, 3.2.x-dev, 2.6.x-dev].
    - Can only install one of: zendframework/zend-eventmanager[2.6.3, 3.1.0].
    - Can only install one of: zendframework/zend-eventmanager[2.6.4, 3.1.0].
    - Can only install one of: zendframework/zend-eventmanager[3.2.0, 3.1.0].
    - Can only install one of: zendframework/zend-eventmanager[3.2.1, 3.1.0].
    - Can only install one of: zendframework/zend-eventmanager[3.3.x-dev, 3.1.0].
    - Can only install one of: zendframework/zend-eventmanager[3.2.x-dev, 3.1.0].
    - Can only install one of: zendframework/zend-eventmanager[2.6.x-dev, 3.1.0].
    - Installation request for zendframework/zend-eventmanager (locked at 3.1.0) -> satisfiable by zendframework/zend-eventmanager[3.1.0].


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

I'm using the tutorial as a base: https://olegkrivtsov.github.io/using-zend-framework-3-book/html/en/Zend_Skeleton_Application/Getting_Zend_Skeleton_Application.html


Solution

  • Typically, this occurs because of conflicting versions of packages

    I recommend restarting the installation process, because your project is new, I think it is faster than resolving all conflicts.

    First, clear the cache and data already installed:

    rm -rf composer.lock vendor
    php composer.phar clear
    

    Restart installing the package with conflict problem

    php composer.phar require zendframework/zend-session
    

    After install anothers packages. Eg:

    php composer.phar require zendframework/zend-cache
    php composer.phar require zendframework/zend-mvc
    php composer.phar require zendframework/zend-db
    php composer.phar require zendframework/zend-modulemanager
    php composer.phar require zendframework/zend-mvc
    php composer.phar require zendframework/zend-mvc-i18n
    php composer.phar require zendframework/zend-crypt
    php composer.phar require zendframework/zend-escaper
    php composer.phar require zendframework/zend-mail
    php composer.phar require zendframework/zend-paginator
    

    In the following tutorial that is, I think that marked Y switch instead of N, in answer for minimal installation packages.

       Do you want a minimal install (no optional packages)? Y/n
    n
    

    But, the clear all data that solution your problem.