我在Windows 10上的流浪汉设置上安装了php 7.0.29版本。
当我运行以下命令时
composer require --dev phpunit/phpunit
我收到的错误
Using version ^6.5 for phpunit/phpunit
./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 phpunit/phpunit 6.5.8
- Conclusion: don't install phpunit/phpunit 6.5.7
- Conclusion: don't install phpunit/phpunit 6.5.6
- Conclusion: don't install phpunit/phpunit 6.5.5
- Conclusion: don't install phpunit/phpunit 6.5.4
- Conclusion: don't install phpunit/phpunit 6.5.3
- Conclusion: don't install phpunit/phpunit 6.5.2
- Conclusion: don't install phpunit/phpunit 6.5.1
- phpunit/dbunit 2.0.3 conflicts with phpunit/phpunit[6.5.0].
- phpunit/phpunit 6.5.0 conflicts with phpunit/dbunit[2.0.3].
- phpunit/phpunit 6.5.0 conflicts with phpunit/dbunit[2.0.3].
- Installation request for phpunit/phpunit ^6.5 -> satisfiable by phpunit/phpunit[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].
- Installation request for phpunit/dbunit (locked at 2.0.3, required as ^2.0) -> satisfiable by phpunit/dbunit[2.0.3].
我的composer.json文件包含以下代码
{
"name": "tsawler/acme",
"authors": [
{
"name": "xyz",
"email": "xyz@example.com"
}
],
"require": {
"filp/whoops": "2.0.*",
"vlucas/phpdotenv": "~1.1",
"illuminate/database": "5.1.*",
"altorouter/altorouter": "1.1.0",
"respect/validation": "~1.0",
"duncan3dc/blade": "2.2.*",
"robmorgan/phinx": "^0.4.5",
"symfony/var-dumper": "^2.7",
"cocur/slugify": "^1.2",
"swiftmailer/swiftmailer": "^5.4",
"kunststube/csrfp": "^0.1.0",
"sunra/php-simple-html-dom-parser": "v1.5.0",
"rdlowrey/auryn": "1.1.*",
"fabpot/goutte": "^3.1"
},
"autoload": {
"psr-4": { "Acme\\": "src/" }
},
"require-dev": {
"phpunit/phpunit": "^5.1",
"phpunit/php-invoker": "^1.1",
"phpunit/dbunit": "^2.0"
}
}
我该如何解决?
答案 0 :(得分:1)
您需要旧版本:
"phpunit/php-invoker": "^1.1",
"phpunit/dbunit": "^2.0"
然而,phpunit需要更多这些依赖项的最新版本,因为它告诉你:
- phpunit/dbunit 2.0.3 conflicts with phpunit/phpunit[6.5.0].
- phpunit/phpunit 6.5.0 conflicts with phpunit/dbunit[2.0.3].
- phpunit/phpunit 6.5.0 conflicts with phpunit/dbunit[2.0.3]
只需要phpunit/phpunit
,让作曲家处理其依赖,而不是要求每个依赖。
答案 1 :(得分:0)
尝试再次要求升级phpunit时出现此错误。对我来说,解决方案是卸载phpunit并重新安装:
$ composer remove phpunit/phpunit --dev
$ composer require phpunit/phpunit --dev
答案 2 :(得分:0)
我遇到了同样的问题。我做到了
composer remove symfony/phpunit-bridge --dev
之后,我通过这样做重新安装了
composer require --dev symfony/phpunit-bridge
然后
php bin/phpunit