一种可能性是您有无法解决的依赖关系:
您的要求无法解决为一组可安装的软件包。
正如其他人所提到的,您可能只需要运行composer install
并等待。如果无法解决依赖关系,composer 将扫描所有可能的选项——这可能需要很长时间。
如果您有很多依赖项 - 您可能想尝试从composer.json
一开始就删除所有内容,然后一次将它们添加回来以发现哪些无法解决。
最终完成时composer install
- 仔细阅读输出,看看是否缺少需要手动安装的依赖项。
就我而言,我只是想安装一个包。这是我的composer.json
:
{
"require-dev": {
"phpunit/phpunit": "^8"
}
composer install
跑了好久终于报:
Problem 1
- phpunit/phpunit 8.5.2 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.5.1 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.5.0 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.4.3 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.4.2 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.4.1 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.4.0 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.3.5 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.3.4 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.3.3 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.3.2 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.3.1 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.3.0 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.2.5 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.2.4 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.2.3 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.2.2 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.2.1 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.2.0 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.1.6 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.1.5 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.1.4 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.1.3 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.1.2 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.1.1 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.1.0 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.0.6 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.0.5 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.0.4 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.0.3 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.0.2 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.0.1 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- phpunit/phpunit 8.0.0 requires ext-dom * -> the requested PHP extension dom is missing from your system.
- Installation request for phpunit/phpunit ^8 -> satisfiable by phpunit/phpunit[8.0.0, 8.0.1, 8.0.2, 8.0.3, 8.0.4, 8.0.5, 8.0.6, 8.1.0, 8.1.1, 8.1.2, 8.1.3, 8.1.4, 8.1.5, 8.1.6, 8.2.0, 8.2.1, 8.2.2, 8.2.3, 8.2.4, 8.2.5, 8.3.0, 8.3.1, 8.3.2, 8.3.3, 8.3.4, 8.3.5, 8.4.0, 8.4.1, 8.4.2, 8.4.3, 8.5.0, 8.5.1, 8.5.2].
所以我安装了缺少的依赖项——PHP 扩展 dom:
sudo apt install php-dom
下次我运行composer install
它成功完成。