I'm trying to use this module on a site that is currently running php 5.6 and drupal 8.5.14 BUT I am running the project locally with Lando, so I've specified php 7.2 in my lando.local.yml .

When I try to lando composer require drupal/upgrade_status ^1.0, it fails to install with this message:

Your requirements could not be resolved to an installable set of packages.

Problem 1
    - Installation request for nikic/php-parser (locked at v3.1.5) -> satisfiable by nikic/php-parser[v3.1.5].
    - drupal/upgrade_status 1.x-dev requires mglaman/phpstan-drupal 0.11.3 -> satisfiable by mglaman/phpstan-drupal[0.11.3].
    - drupal/upgrade_status 1.0.0-alpha1 requires mglaman/phpstan-drupal 0.11.3 -> satisfiable by mglaman/phpstan-drupal[0.11.3].
    - Conclusion: don't install mglaman/phpstan-drupal 0.11.3
    - Installation request for drupal/upgrade_status ^1.0 -> satisfiable by drupal/upgrade_status[1.x-dev, 1.0.0-alpha1].

I can't simply NOT install one of the module's dependencies, so what do I do?

Comments

bhogue created an issue. See original summary.

bhogue’s picture

Issue summary: View changes
bhogue’s picture

I had to explicitly require phpstan-drupal and php-parser via composer to get upgrade_status to successfully install:

"mglaman/phpstan-drupal": "0.11.3",
"nikic/php-parser": "^4.2"

Once I did that, when I went to activate the module through the Drupal admin, I got this error

Fatal error: require(): Failed opening required '/app/vendor/composer/../doctrine/common/lib/Doctrine/Common/Reflection/ClassFinderInterface.php' (include_path='.:/usr/local/lib/php') in /app/vendor/symfony/class-loader/ApcClassLoader.php on line 112

Note that I also upgraded Drupal core from 8.5.14 to 8.6.14. When I did so, I did composer update drupal/core --with-dependencies.

hotwebmatter’s picture

mglaman’s picture

gábor hojtsy’s picture

@bhogue did that actually end up getting you v4 of PHP parser? As per https://github.com/mglaman/phpstan-drupal/issues/57 even if we require it composer would not comply. If you did not get v4, can you try removing drush and then composer updating and then adding drush again?

mglaman’s picture

For the record, #3 is the required approach to fix the dependency. Weird on the second error.

gábor hojtsy’s picture

Title: Install via composer fails due to dependencies » Document how to resolve nikic/php-parser v3 vs v4 composer issue
Category: Bug report » Task
Status: Needs work » Active

Looks like there is not much here but to document that this is how it is.

gábor hojtsy’s picture

Status: Active » Fixed

I added this to the project page in hopes that I understand the scope of the problem. Let me know what to update it to, happy to do so.

A common composer installation problem due to nikic/php-parser

If you have Drush installed with composer from before, you may get a composer problem starting off with Installation request for nikic/php-parser.... Upgrade Status requires nikic/php-parser version 4. This is also compatible with Drush but your prior Drush installation may have installed version 3, which composer will not automatically update to version 4. You should set the dependency requirement explicitly:

$ composer require 'nikic/php-parser:^4.2'
aangel’s picture

Unfortunately, I had no luck at all installing this module on a Drupal 8.7.3 / Drush 9.7.0 project (running inside Lando). Always deleting composer.lock and removing nikic from the vendor directory between tests, I tried:

Adding "drupal/upgrade_status". That failed.
Adding "nikic/php-parser": "^4.2" (while keeping "drupal/upgrade_status"). That failed.
Then I removed both of the above and removed drush and added mglaman/phpstan-drupal. That failed.
Then I removed phpstan-drupal and went back to just "nikic/php-parser:^4.2.2" again and got:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for sensiolabs-de/deprecation-detector dev-master -> satisfiable by sensiolabs-de/deprecation-detector[dev-master].
    - Can only install one of: nikic/php-parser[4.2.x-dev, 3.x-dev].
    - Can only install one of: nikic/php-parser[v4.2.2, 3.x-dev].
    - Conclusion: install nikic/php-parser 3.x-dev
    - Installation request for nikic/php-parser ^4.2.2 -> satisfiable by nikic/php-parser[4.2.x-dev, v4.2.2].

It's not clear to me where to go from here.

mglaman’s picture

#10 is a conflict with acquia/blt 9: https://github.com/mglaman/drupal-check/issues/9

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

aangel’s picture

Thanks, Matt. We had removed BLT—mostly. Missed removing deprecation-detector.

With that gone the module installs and runs nicely.