无法安装phpunit,结论:不要安装phpunit/phpunit 6.5.8



我在 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].

我的作曲家.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"
    }
}

我该如何解决?

  • 我在尝试通过再次要求来升级我的 phpunit 时收到此错误。我的解决方案是卸载phpunit并重新安装它:

          $ composer remove phpunit/phpunit --dev
          $ composer require phpunit/phpunit --dev
    

您需要以下版本的旧版本:

"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 ,而是让作曲家处理其依赖项,而不是要求每个依赖项。

我遇到了同样的问题。我做了

composer remove symfony/phpunit-bridge --dev

之后,我通过做重新安装了它

composer require --dev symfony/phpunit-bridge

然后

php bin/phpunit

相关内容

  • 没有找到相关文章

最新更新