cakephp / localized

I18n and L10n related CakePHP code
Other
214 stars 179 forks source link

I can't install via composer, it conflicts with Chronos #215

Closed esallum-iluminare closed 3 years ago

esallum-iluminare commented 3 years ago

I tried to install cakephp/localized using the following commands:

composer require cakephp/localized

composer.phar require --update-with-dependencies "cakephp/localized"

And gives the following error:

$ composer.phar require --update-with-dependencies -W "cakephp/localized"
Using version ^3.5 for cakephp/localized
./composer.json has been updated
Running composer update cakephp/localized --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - cakephp/localized[3.5.0, ..., 3.5.2] require cakephp/cakephp ^3.5 -> satisfiable by cakephp/cakephp[3.5.0, ..., 3.10.0].
    - cakephp/cakephp[3.5.0, ..., 3.5.14] require cakephp/chronos ^1.0.0 -> found cakephp/chronos[1.0.0, ..., 1.3.0] but it conflicts with your root composer.json require (^2).
    - cakephp/cakephp[3.5.15, ..., 3.10.0] require cakephp/chronos ^1.0.1 -> found cakephp/chronos[1.0.1, ..., 1.3.0] but it conflicts with your root composer.json require (^2).
    - Root composer.json requires cakephp/localized ^3.5 -> satisfiable by cakephp/localized[3.5.0, 3.5.1, 3.5.2].

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

If I manually enter cakephp/localized no in composer.json file and give composer.update command, it conflicts with cakephp/database:

$ composer update
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires selective/array-reader ^1.1 -> satisfiable by selective/array-reader[1.1.0].
    - selective/array-reader 1.1.0 requires cakephp/chronos ^2 -> found cakephp/chronos[2.0.0, ..., 2.2.0] but it conflicts with your root composer.json require (^1).
  Problem 2
    - Root composer.json requires cakephp/localized 3.5.2 -> satisfiable by cakephp/localized[3.5.2].
    - Conclusion: don't install cakephp/database 4.0.2 (conflict analysis result)
    - Conclusion: don't install cakephp/database 4.0.3 (conflict analysis result)
    - Conclusion: don't install cakephp/database 4.0.4 (conflict analysis result)
    - Conclusion: don't install cakephp/database 4.0.5 (conflict analysis result)
    - Conclusion: don't install cakephp/database 4.0.6 (conflict analysis result)
    - Conclusion: don't install cakephp/database 4.0.7 (conflict analysis result)
    - Conclusion: don't install cakephp/database 4.0.8 (conflict analysis result)
    - Conclusion: don't install cakephp/database 4.0.9 (conflict analysis result)
    - Conclusion: don't install cakephp/database 4.1.0 (conflict analysis result)
    - Conclusion: don't install cakephp/database 4.1.1 (conflict analysis result)
    - Conclusion: don't install cakephp/database 4.1.2 (conflict analysis result)
    - Conclusion: don't install cakephp/database 4.1.3 (conflict analysis result)
    - Conclusion: don't install cakephp/database 4.1.4 (conflict analysis result)
    - Conclusion: don't install cakephp/database 4.1.5 (conflict analysis result)
    - Conclusion: don't install cakephp/database 4.1.6 (conflict analysis result)
    - Conclusion: don't install cakephp/database 4.1.7 (conflict analysis result)
    - Conclusion: don't install cakephp/database 4.2.0 (conflict analysis result)
    - Conclusion: don't install cakephp/database 4.2.1 (conflict analysis result)
    - Conclusion: don't install cakephp/database 4.2.2 (conflict analysis result)
    - Conclusion: don't install cakephp/database 4.2.3 (conflict analysis result)
    - Conclusion: don't install cakephp/database 4.2.4 (conflict analysis result)
    - Conclusion: don't install cakephp/database 4.2.5 (conflict analysis result)
    - Conclusion: don't install cakephp/database 4.2.6 (conflict analysis result)
    - Conclusion: don't install cakephp/database 4.2.7 (conflict analysis result)
    - Conclusion: don't install cakephp/database 4.0.1 (conflict analysis result)
    - cakephp/localized 3.5.2 requires cakephp/cakephp ^3.5 -> satisfiable by cakephp/cakephp[3.5.0, ..., 3.10.0].
    - Only one of these can be installed: cakephp/cakephp[3.5.0, ..., 3.10.0], cakephp/database[4.0.0, ..., 4.2.7]. cakephp/cakephp replaces cakephp/database and thus cannot coexist with it.
    - Root composer.json requires cakephp/database ^4 -> satisfiable by cakephp/database[4.0.0, ..., 4.2.7].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

The following dependencies are in my composer.json file:

"cakephp/chronos": "^2",
"cakephp/database": "^4",
"cakephp/validation": "^4.2",

How can I fix this error?

garas commented 3 years ago

You need to use 4.x version with CakePHP 4.

There is version 4.0.0-beta of cakephp/localized.

dereuromark commented 3 years ago

We should release that stable version IMO :)

dereuromark commented 3 years ago

https://github.com/cakephp/localized/releases/tag/4.0.0

esallum-iluminare commented 3 years ago

I'm delighted the way I was helped. Thanks @dereuromark

esallum-iluminare commented 3 years ago

Is there any way to install localized without removing the following dependencies?:

$ composer require cakephp/localized
Using version ^4.0 for cakephp/localized
./composer.json has been updated
Running composer update cakephp/localized
Loading composer repositories with package information
Updating dependencies
Lock file operations: 8 installs, 0 updates, 5 removals
  **- Removing cakephp/core (4.2.7)
  - Removing cakephp/database (4.2.7)
  - Removing cakephp/datasource (4.2.7)
  - Removing cakephp/utility (4.2.7)
  - Removing cakephp/validation (4.2.7)**
  - Locking cakephp/cakephp (4.2.7)
  - Locking cakephp/localized (4.0.0)
  - Locking composer/ca-bundle (1.2.10)
  - Locking laminas/laminas-diactoros (2.6.0)
  - Locking laminas/laminas-httphandlerrunner (1.4.0)
  - Locking laminas/laminas-zendframework-bridge (1.3.0)
  - Locking league/container (3.3.5)
  - Locking psr/http-client (1.0.1)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 8 installs, 0 updates, 5 removals
  **- Removing cakephp/validation (4.2.7)
  - Removing cakephp/utility (4.2.7)
  - Removing cakephp/datasource (4.2.7)
  - Removing cakephp/database (4.2.7)
  - Removing cakephp/core (4.2.7)**
  - Installing psr/http-client (1.0.1): Extracting archive
  - Installing league/container (3.3.5): Extracting archive
  - Installing laminas/laminas-zendframework-bridge (1.3.0): Extracting archive
  - Installing laminas/laminas-diactoros (2.6.0): Extracting archive
  - Installing laminas/laminas-httphandlerrunner (1.4.0): Extracting archive
  - Installing composer/ca-bundle (1.2.10): Extracting archive
  - Installing cakephp/cakephp (4.2.7): Extracting archive
  - Installing cakephp/localized (4.0.0): Extracting archive
2 package suggestions were added by new dependencies, use `composer suggest` to see details.
Generating autoload files
65 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
garas commented 3 years ago

Those removed packages are replaced with Installing cakephp/cakephp (4.2.7).

Your app will continue to work because all classes from cakephp/database and cakephp/validation are included cakephp/cakephp.

esallum-iluminare commented 3 years ago

@garas Unfortunately it's giving the following error in my api:

The \"_cakecore\" cache configuration does not exist. in C:\xampp\htdocs\conventionsector\vendor\cakephp\cakephp\src\Cache\Cache.php

garas commented 3 years ago

It now tries to use caching because Cache class is now installed and exists.

You can configure cache with Cache::setConfig('_cake_core_', [...]); or just disable it with Cache::disable().


cakephp/localized probably could depend on cakephp/i18n + cakephp/http only and would avoid your situation.

To avoid cakephp/http dependency, usage of Cake\Http\Exception\NotImplementedException could be replaced with some non-http exception as it is also wrong exception type in this case. But as 4.0 is now released it could be breaking change.