Roots Discourse

Issue with doctrine/inflector

I’m not sure what’s up here, and my experience w/ Composer is limited (maybe I’m missing something obvious)?

I saw this on Sage 9.0.1 (both before and after running composer update)

$ composer require stoutlogic/acf-builder      
Using version ^1.6 for stoutlogic/acf-builder
./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 doctrine/inflector == 1.3.0.0 -> satisfiable by doctrine/inflector[v1.3.0].
    - stoutlogic/acf-builder 1.6.0 requires doctrine/inflector ~1.1.0 -> satisfiable by doctrine/inflector[v1.1.0].
    - stoutlogic/acf-builder 1.6.1 requires doctrine/inflector ~1.1.0 -> satisfiable by doctrine/inflector[v1.1.0].
    - Conclusion: dont install doctrine/inflector v1.1.0
    - Installation request for stoutlogic/acf-builder ^1.6 -> satisfiable by stoutlogic/acf-builder[1.6.0, 1.6.1].


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

Also tried installing version-specific packages, e.g.:

composer require stoutlogic/acf-builder:1.6.0
composer require stoutlogic/acf-builder:1.6.1

…with no luck.

Thanks!

Looks like you’re running into this problem because you have things with conflicting version constraints for doctrine/inflector. Specifically, something wants exactly 1.3.0.0, and something else wants >= 1.1.0 but < 1.2.0 (if I’m reading them correctly). I always struggle a bit with understainding the details of Composers version constraints, but they’re generally worth reading: https://getcomposer.org/doc/articles/versions.md#next-significant-release-operators

You should be able to run composer depends doctrine/inflector to see what all is requiring it, and that might help you track down the problem package. The only thing I know for sure in Sage that requires doctrine/inflector is illuminate/support, but my reading of the package requirements for it and stoutlogic/acf-builder don’t seem to suggest a package conflict, so maybe you have something else that’s pulling it in.

1 Like

Thanks @alwaysblank!

I’m testing on a vanilla Sage install w/o any other Composer packages.

$ composer depends doctrine/inflector
illuminate/support  v5.6.24  requires  doctrine/inflector (~1.1)   

@Log1x?

Okay, so after a bit of testing, here is how you can fix this problem:

  • Delete vendor/
  • Delete composer.lock
  • Run composer require stoutlogic/acf-builder

Near as I can tell, the issue is that if you have already run composer install/composer update then illuminate/support's permissive dependecy requirement installs the latest version of doctrine/inflector—1.3.0—and saves that in composer.lock. If you then try and run composer require stoutlogic/acf-builder, composer appears to say “No, I’ve already got 1.3.0 locked, I’m not downgrading that” and fails. If you just remove composer.lock, composer appears to say “No, you’ve already installed 1.3.0, and I assume you had a good reason for it, so I’m not downgrading that” and fails. But if you remove your installation of doctrine/inflector, then composer is willing to evaluate all your requirements and install what meets them, which is a version of doctrine/inflector that everyone can be happy with.

There is probably a better way to do this than deleting composer.lock and vendor but for now that seems to work.

1 Like

thank you SO much @alwaysblank !!!