Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version "dev-php74-compat" of "leafo/lessphp" does no exist #16082

Closed
sebastian-lenz opened this issue Jun 17, 2020 · 8 comments · Fixed by #16813
Closed

Version "dev-php74-compat" of "leafo/lessphp" does no exist #16082

sebastian-lenz opened this issue Jun 17, 2020 · 8 comments · Fixed by #16813
Assignees
Labels
not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.

Comments

@sebastian-lenz
Copy link

I've just tried to install Matomo directly from the repository / via composer and the installation fails due to this requirement in composer.json:

"leafo/lessphp": "dev-php74-compat"

As it turns out, there is no such version as "dev-php74-compat", see https://packagist.org/packages/leafo/lessphp

@sebastian-lenz
Copy link
Author

Ah, I've found it, you define your own repository a few lines below:
https://github.com/matomo-org/matomo/blob/4.x-dev/composer.json#L94

However, this makes it impossible to depend on Matomo as a dependency installed by composer.

@Findus23
Copy link
Member

Hi, see #15180 for more information on why this is a slightly ugly hack.

Matomo 3.x supports PHP 5.5 or later, so it can not be updated to the latest version of lessphp(which dropped support a while ago).

But Matomo also needs to support PHP 7.4 which means this patch (matomo-org/lessphp@f16f698) needs to be applied to avoid warnings.

With Matomo 4 support for old PHP versions is dropped so it should not matter anymore, but this means leafo/lessphp#647 still needs to be merged.

@tsteur
Copy link
Member

tsteur commented Jun 17, 2020

If this is resolved in Matomo 4 basically can we close this issue? Or we still wait for the other issue to be merged?

@sebastian-lenz
Copy link
Author

The composer file on branch 4.x-dev also contains references to the version dev-php74-compat of the module leafo/lessphp that only can be installed when directly cloning the Matomo repository and it is still not possible to depend on Matomo as a package / requirement / dependency.

The problem

In the current state, installing Matomo using the following command is not possible:

composer require piwik/piwik

The command fails with an error like this:

Using version ^3.13 for piwik/piwik
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - piwik/piwik 3.13.6 requires leafo/lessphp dev-php74-compat -> no matching package found.

Which is sad cause is both prevents users from installing and updating Matomo using composer and also makes it impossible to create other projects that depend on Matomo.

The cause

The core issue is that Matomo currently relies on two private packages that must be installed from custom repositories as configured in Matomos composer file but composer does not load the repositories of requirements:

https://getcomposer.org/doc/faqs/why-can%27t-composer-load-repositories-recursively.md

Currently, every package that depends on Matomo must repeat the repositories section in their own composer.json.

The solution

Get rid of the section repositories in composer.json by either:

  • publishing the required packages to the public composer repository
  • switching to alternatives that are already publicly available
  • moving the code to the own package
  • removing the packages by creating the compiled assets at build time

@creativecoder
Copy link

Seeing the 4.0 release, I just tried to upgrade my composer based matomo project to v4.0 and found this same issue

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

  Problem 1
    - Root composer.json requires matomo/matomo ^4.0 -> satisfiable by matomo/matomo[4.0.0].
    - matomo/matomo 4.0.0 requires leafo/lessphp dev-php74-compat -> found leafo/lessphp[dev-master, dev-pull-523, v0.3.5, ..., v0.5.0] but it does not match the constraint.

It'd be great to get this resolved now that v4 is released, so composer support isn't broken.

@Findus23
Copy link
Member

@creativecoder I think to be able to go back to the normal upstream release, this pull request needs to be merged as without it lessphp won't work in Matomo when using PHP 7.4 or above.

Once this is done and there is a new lessphp release (this part is optional as we could depend on a commit hash) we can simply use it instead.

@sgiehl
Copy link
Member

sgiehl commented Nov 25, 2020

I will check how easy it would be to maybe switch to https://github.com/wikimedia/less.php instead. Should be more maintained 🙈

@Findus23
Copy link
Member

@sgiehl Considering that there is a section about this this could be surprisingly easy (I didn't know that there was another PHP implementation).

Especially as it should not change the rest of the asset handling (as long as it compiles the css the same). (even though supporting source maps would be really nice for the future)

@sgiehl sgiehl self-assigned this Nov 26, 2020
@mattab mattab added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Dec 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants