解決 Composer 升級 PHPUnit 版本 6 到 7 遇到問題 Your requirements could not be resolved to an installable set of packages

Composer 升級 PHPUnit 版本 6.5.8 到 7 遇到問題「Your requirements could not be resolved to an installable set of packages. ... ... Installation failed, reverting ./composer.json to its original content.」。解決方法是移除 PHPUnit 再重新安裝。

錯誤狀況
$ composer require --dev phpunit/phpunit ^7.0
./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
- phpunit/dbunit 3.0.3 requires phpunit/phpunit ^6.0 -> satisfiable by phpunit/phpunit[6.0.0, 6.0.1, 6.0.10, 6.0.11, 6.0.12, 6.0.13, 6.0.2, 6.0.3, 6.0.4, 6.0.5, 6.0.6, 6.0.7, 6.0.8, 6.0.9, 6.0.x-dev, 6.1.0, 6.1.1, 6.1.2, 6.1.3, 6.1.4, 6.1.x-dev, 6.2.0, 6.2.1, 6.2.2, 6.2.3, 6.2.4, 6.2.x-dev, 6.3.0, 6.3.1, 6.3.x-dev, 6.4.0, 6.4.1, 6.4.2, 6.4.3, 6.4.4, 6.4.x-dev, 6.5.0, 6.5.1, 6.5.2, 6.5.3, 6.5.4, 6.5.5, 6.5.6, 6.5.7, 6.5.8, 6.5.x-dev] but these conflict with your requirements or minimum-stability.
- phpunit/dbunit 3.0.3 requires phpunit/phpunit ^6.0 -> satisfiable by phpunit/phpunit[6.0.0, 6.0.1, 6.0.10, 6.0.11, 6.0.12, 6.0.13, 6.0.2, 6.0.3, 6.0.4, 6.0.5, 6.0.6, 6.0.7, 6.0.8, 6.0.9, 6.0.x-dev, 6.1.0, 6.1.1, 6.1.2, 6.1.3, 6.1.4, 6.1.x-dev, 6.2.0, 6.2.1, 6.2.2, 6.2.3, 6.2.4, 6.2.x-dev, 6.3.0, 6.3.1, 6.3.x-dev, 6.4.0, 6.4.1, 6.4.2, 6.4.3, 6.4.4, 6.4.x-dev, 6.5.0, 6.5.1, 6.5.2, 6.5.3, 6.5.4, 6.5.5, 6.5.6, 6.5.7, 6.5.8, 6.5.x-dev] but these conflict with your requirements or minimum-stability.
- phpunit/dbunit 3.0.3 requires phpunit/phpunit ^6.0 -> satisfiable by phpunit/phpunit[6.0.0, 6.0.1, 6.0.10, 6.0.11, 6.0.12, 6.0.13, 6.0.2, 6.0.3, 6.0.4, 6.0.5, 6.0.6, 6.0.7, 6.0.8, 6.0.9, 6.0.x-dev, 6.1.0, 6.1.1, 6.1.2, 6.1.3, 6.1.4, 6.1.x-dev, 6.2.0, 6.2.1, 6.2.2, 6.2.3, 6.2.4, 6.2.x-dev, 6.3.0, 6.3.1, 6.3.x-dev, 6.4.0, 6.4.1, 6.4.2, 6.4.3, 6.4.4, 6.4.x-dev, 6.5.0, 6.5.1, 6.5.2, 6.5.3, 6.5.4, 6.5.5, 6.5.6, 6.5.7, 6.5.8, 6.5.x-dev] but these conflict with your requirements or minimum-stability.
- Installation request for phpunit/dbunit (locked at 3.0.3, required as ^3.0) -> satisfiable by phpunit/dbunit[3.0.3].
Installation failed, reverting ./composer.json to its original content.

解決方法:移除 phpunit 再重新安裝。
$ composer remove phpunit/phpunit
phpunit/phpunit could not be found in require but it is present in require-dev
Do you want to remove it from require-dev [yes]? yes
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 0 installs, 7 updates, 0 removals
- Updating sebastian/diff (2.0.1 => 3.0.0): Downloading (100%)
- Updating sebastian/comparator (2.1.3 => 3.0.0): Downloading (100%)
- Updating phpunit/phpunit-mock-objects (5.0.6 => 6.1.1): Downloading (100%)
- Updating phpunit/php-timer (1.0.9 => 2.0.0): Downloading (100%)
- Updating phpunit/php-token-stream (2.0.2 => 3.0.0): Downloading (100%)
- Updating phpunit/php-code-coverage (5.3.2 => 6.0.3): Downloading (100%)
- Updating phpunit/phpunit (6.5.8 => 7.1.4): Downloading (100%)
Package phpoffice/phpexcel is abandoned, you should avoid using it. Use phpoffice/phpspreadsheet instead.
Writing lock file
Generating autoload files 
$ composer require --dev phpunit/phpunit ^7.0
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Package phpoffice/phpexcel is abandoned, you should avoid using it. Use phpoffice/phpspreadsheet instead.
Writing lock file
Generating autoload files

相關資料









留言