Installation error for phpunit / phpunit ^ 6.2

when i ran

composer require --dev phpunit/phpunit

      

I receive the following message:

composer require --dev phpunit/phpunit
Using version ^6.2 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
- Installation request for sebastian/object-enumerator (locked at 2.0.1) -> satisfiable by sebastian/object-enumerator[2.0.1].
- phpunit/phpunit 6.2.0 requires sebastian/object-enumerator ^3.0.2 -> satisfiable by sebastian/object-enumerator[3.0.2].
- phpunit/phpunit 6.2.1 requires sebastian/object-enumerator ^3.0.2 -> satisfiable by sebastian/object-enumerator[3.0.2].
- phpunit/phpunit 6.2.2 requires sebastian/object-enumerator ^3.0.2 -> satisfiable by sebastian/object-enumerator[3.0.2].
- phpunit/phpunit 6.2.3 requires sebastian/object-enumerator ^3.0.2 -> satisfiable by sebastian/object-enumerator[3.0.2].
- Conclusion: don't install sebastian/object-enumerator 3.0.2
- Installation request for phpunit/phpunit ^6.2 -> satisfiable by phpunit/phpunit[6.2.0, 6.2.1, 6.2.2, 6.2.3].

Installation failed, reverting ./composer.json to its original content.

      

Here is my executor json file:

"require": {
  "php": "^7.0",
  "laravel/framework": "^5.4",
  "guzzlehttp/guzzle": "^6.3",
  "symfony/psr-http-message-bridge": "^1.0",
  "mcamara/laravel-localization": "^1.2",
  "laravelcollective/html": "^5.4",
  "laravel/socialite": "^3.0",
  "yajra/laravel-datatables-oracle": "^7.9"
},
"require-dev": {
  "fzaninotto/faker": "^1.6",
  "symfony/css-selector": "^3.3",
  "symfony/dom-crawler": "^3.3"
}

      

I tried to get from 5.4 version above and always get similar error but with different dependencies, the only version that seems to work is 5.0

+3


source to share


2 answers


Run

$ composer require --dev phpunit/phpunit --update-with-dependencies

      

See https://getcomposer.org/doc/03-cli.md#require :



- update-with-dependencies . Also update the dependencies of new packages.

Note Deleting composer.lock

under circumstances such as this is not really the best idea, as it can cause freezes that break your code elsewhere. You really only want to update a specific dependency at a time, not update all at once.

+8


source


If you run composer update

with a file composer.lock

and a folder present vendor

, Composer will migrate installed versions to accounts before upgrading.

Make sure the lock file is committed to your project repository to be able to restore the current version. Then try another update, but before doing so, delete the lock file and vendor folder.



It is my experience that such an update will not be affected by the versions already installed, which may interfere with the necessary updates.

Another option for debugging dependencies is to use composer why-not phpunit/phpunit 6.2.0

(use the explicit version you know - without the version, the command output is meaningless). Composer will provide you with a list of dependencies that are preventing the upgrade for further study.

+2


source







All Articles