Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to install phpunit ,Conclusion: don't install phpunit/phpunit 6.5.8

I have php 7.0.29 version installed on my vagrant setup on windows 10.

When I run following command

composer require --dev phpunit/phpunit

I get errors as mentioned

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

My composer.json file has following code

{
    "name": "tsawler/acme",
    "authors": [
        {
            "name": "xyz",
            "email": "[email protected]"
        }
    ],
    "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"
    }
}

How do I fix it?

like image 351
Mukesh Avatar asked Jan 28 '23 05:01

Mukesh


2 Answers

  • I got this error when trying to upgrade my phpunit by requiring it again. Solution for me was to uninstall phpunit and reinstall it:

          $ composer remove phpunit/phpunit --dev
          $ composer require phpunit/phpunit --dev
    
like image 168
Shabeer K Avatar answered Feb 13 '23 06:02

Shabeer K


You are requiring old versions of:

"phpunit/php-invoker": "^1.1",
"phpunit/dbunit": "^2.0"

Yet phpunit requires more up to date version of those dependencies as it tells you here:

- 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]

Only require phpunit/phpunit, instead and let composer handle its dependencies instead of requiring each dependency.

like image 31
k0pernikus Avatar answered Feb 13 '23 06:02

k0pernikus