darrenjacoby / intervention

WordPress plugin to configure wp-admin and application state using a single config file.
MIT License
640 stars 51 forks source link

Composer dependency incompatibilities with Sage 9 #100

Closed markmercier closed 1 year ago

markmercier commented 2 years ago

Hey there - love the library and running the newest version as a standalone plugin but running into trouble getting it to install via Composer on Sage 9.

I tested fresh installs of:

on one computer running MacOS 10.14, another running 10.15, and then (thinking it might be OS-related) upgraded the latter to 12.1 and tested again. All Sage installations and OS versions gave the same error:

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

  Problem 1
    - illuminate/collections[v8.51.0, ..., v8.80.0] require illuminate/contracts ^8.0 -> found illuminate/contracts[v8.0.0, ..., v8.80.0] but the package is fixed to v5.6.39 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - soberwp/intervention dev-main requires illuminate/collections ^8.51 -> satisfiable by illuminate/collections[v8.51.0, ..., v8.80.0].
    - Root composer.json requires soberwp/intervention dev-main -> satisfiable by soberwp/intervention[dev-main].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

If I try the --with-all-dependencies flag, I get this error message:

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

  Problem 1
    - roots/sage-installer is locked to version 1.6.3 and an update of this package was not requested.
    - Conclusion: don't install illuminate/contracts v5.6.2 (conflict analysis result)
    - ...
    - MANY MANY MORE DON'T INSTALL SPECIFIC ILLUMINATE/CONTRACTS VERSIONS, TRUNCATED FOR BREVITY
    - ...
    - Conclusion: don't install illuminate/contracts v5.6.39 (conflict analysis result)
    - illuminate/view v5.6.39 requires illuminate/container 5.6.* -> satisfiable by illuminate/container[v5.6.39].
    - roots/sage-lib 9.0.9 requires illuminate/view ~5.6 -> satisfiable by illuminate/view[v5.6.39].
    - roots/sage-lib is locked to version 9.0.9 and an update of this package was not requested.
    - illuminate/support is locked to version v5.6.39 and an update of this package was not requested.
    - Root composer.json requires soberwp/intervention dev-main -> satisfiable by soberwp/intervention[dev-main].
    - soberwp/intervention dev-main requires illuminate/collections ^8.51 -> satisfiable by illuminate/collections[v8.51.0, ..., v8.80.0].
    - illuminate/collections[v8.51.0, ..., v8.80.0] require illuminate/contracts ^8.0 -> satisfiable by illuminate/contracts[v8.0.0, ..., v8.80.0].
    - You can only install one version of a package, so only one of these can be installed: illuminate/contracts[v5.6.0, ..., v5.6.39, v8.0.0, ..., v8.80.0].
    - illuminate/container v5.6.39 requires illuminate/contracts 5.6.* -> satisfiable by illuminate/contracts[v5.6.0, ..., v5.6.39].
    - Conclusion: don't install illuminate/contracts v5.6.1 (conflict analysis result)

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

I tried removing or upgrading various Composer packages to try to get it to work with no success (but I'm no Composer expert, so don't consider that an exhaustive effort).

Intervention installs perfectly via composer on a fresh copy of Sage 10, but it'd be awesome to get it working on 9, particularly since 10 is still pre-release and seems to be a rather complex upgrade.

Let me know if there's any other information I can provide on this or other things I can test! Thanks in advance.

darrenjacoby commented 2 years ago

Hey @markmercier,

Thanks for reporting, I am aware of this issue, ran into it myself not long ago. The problem is that Sage 9 requires an older version of illuminate, and Intervention is using a newer version. (Intervention makes use of Laravel collections).

I need to implement php-scoper to scope those classes to avoid conflicts. Hoping to get around to it soon. I still need to look into it, but if it's going to take long I will roll back to using tightenco/collect package, which did not clash with Sage 9 and still worked the same.

darrenjacoby commented 2 years ago

To add; if anyone has experience with php-scoper, I would very much welcome a PR.

markmercier commented 2 years ago

Hey @darrenjacoby holy cow appreciate the incredibly quick response! Somewhat relieved to find out it's a known issue and not some crazy random problem with my machine.

Plugin copy is a great fallback so things are good for the meantime but I imagine there are a handful of devs like me that are lowkey dreading upgrading to Sage 10 so anything that helps prolong the lifespan of Sage 9 would be amazing lol.

darrenjacoby commented 2 years ago

No problem! I am in the process of wrapping up a full fledged UI for Intervention, and will get this sorted right after.

darrenjacoby commented 2 years ago

@markmercier you can give the branch interface a go, it has phpscoper implemented.

markmercier commented 2 years ago

Hey @darrenjacoby I just got around to testing this out but I'm still getting what seems to be the same issue :/.

Obvious question first: is composer require soberwp/intervention:dev-interface the right composer command to grab that branch? It seems like it's finding it so I assume so. This is the error I'm getting:

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

  Problem 1
    - illuminate/collections[v8.51.0, ..., v8.83.1] require illuminate/contracts ^8.0 -> found illuminate/contracts[v8.0.0, ..., v8.83.1] but the package is fixed to v5.6.39 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - soberwp/intervention dev-interface requires illuminate/collections ^8.51 -> satisfiable by illuminate/collections[v8.51.0, ..., v8.83.1].
    - Root composer.json requires soberwp/intervention dev-interface -> satisfiable by soberwp/intervention[dev-interface].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

If I try that same --with-all-dependencies flag I get what seems to be the same issue as previous:

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

  Problem 1
    - roots/sage-lib is locked to version 9.0.9 and an update of this package was not requested.
    - Conclusion: don't install illuminate/contracts v5.6.2 (conflict analysis result)
    - ...
    - MANY MANY MORE DON'T INSTALL SPECIFIC ILLUMINATE/CONTRACTS VERSIONS, TRUNCATED FOR BREVITY
    - ...
    - Conclusion: don't install illuminate/contracts v5.6.39 (conflict analysis result)
    - illuminate/view v5.6.39 requires illuminate/container 5.6.* -> satisfiable by illuminate/container[v5.6.39].
    - roots/sage-lib 9.0.9 requires illuminate/view ~5.6 -> satisfiable by illuminate/view[v5.6.39].
    - illuminate/support is locked to version v5.6.39 and an update of this package was not requested.
    - roots/sage-installer is locked to version dev-webpack5 and an update of this package was not requested.
    - Root composer.json requires soberwp/intervention dev-interface -> satisfiable by soberwp/intervention[dev-interface].
    - soberwp/intervention dev-interface requires illuminate/collections ^8.51 -> satisfiable by illuminate/collections[v8.51.0, ..., v8.83.1].
    - illuminate/collections[v8.51.0, ..., v8.83.1] require illuminate/contracts ^8.0 -> satisfiable by illuminate/contracts[v8.0.0, ..., v8.83.1].
    - You can only install one version of a package, so only one of these can be installed: illuminate/contracts[v5.6.0, ..., v5.6.39, v8.0.0, ..., v8.83.1].
    - illuminate/container v5.6.39 requires illuminate/contracts 5.6.* -> satisfiable by illuminate/contracts[v5.6.0, ..., v5.6.39].
    - Conclusion: don't install illuminate/contracts v5.6.1 (conflict analysis result)

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

I tried this on a site I'm actively working on as well as a fresh Sage "9.x" installation from this Discourse post.

Let me know if there's anything else that would be helpful for me to test and thanks again!

darrenjacoby commented 2 years ago

@markmercier I need to dig a little deeper on this still, but I think the issue is that it's still running composer install when grabbing it from packagist. I believe moving this over to wpackagist/WordPress.org #104 will solve this, just need a bit more time!