Search code examples
composer-phpcontao

composer why-not is not helpful - why can I not install this package


I can not require the following package in a contao project.

$ php composer.phar require -v con4gis/con4gis_forum
Using version ^1.7 for con4gis/con4gis_forum
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Dependency resolution completed in 0.026 seconds
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Conclusion: don't install con4gis/con4gis_forum v1.7.1
    - Installation request for con4gis/con4gis_forum ^1.7 -> satisfiable by con4gis/con4gis_forum[v1.7.0, v1.7.1].
    - con4gis/con4gis_forum v1.7.0 requires con4gis/con4gis_core ~1.7 -> satisfiable by con4gis/con4gis_core[v1.7.0, v1.7.1].
    - con4gis/con4gis_core v1.7.0 requires menatwork/contao-multicolumnwizard 3.3.8 -> satisfiable by menatwork/contao-multicolumnwizard[3.3.8].
    - con4gis/con4gis_core v1.7.1 requires menatwork/contao-multicolumnwizard 3.3.8 -> satisfiable by menatwork/contao-multicolumnwizard[3.3.8].
    - Conclusion: don't install menatwork/contao-multicolumnwizard 3.3.8


$ php composer.phar why-not menatwork/contao-multicolumnwizard
contao-legacy/semantic_html5      1.1.7.9014    requires  contao-legacy/multicolumnwizard (>=3.0.0,<4.0.0-dev)  
metamodels/attribute_alias        2.0.0-alpha2  requires  menatwork/contao-multicolumnwizard (~3.3)             
metamodels/core                   2.0.0-alpha9  requires  menatwork/contao-multicolumnwizard (~3.3)             
psi/news4ward                     2.2.3         requires  menatwork/contao-multicolumnwizard (~3)               
terminal42/contao-changelanguage  3.1.0         requires  menatwork/contao-multicolumnwizard (^3.3)     

I checked all the requires printed from why not and 3.3.8 is already green, i.e. satisfied on https://semver.mwl.be/#?package=menatwork%2Fcontao-multicolumnwizard&version=%5E3.3&minimum-stability=stable

What is going on?

Deleting the composer.lock also did not help.

Composer version is latest stable.

Composer.json

{
    "name": "local/website",
    "description": "A local website project",
    "type": "project",
    "license": "proprietary",
    "require": {
    "cgo-it/news4ward-rateit": "dev-master",
    "contao-legacy/ce_page_teaser": "~1.5",
    "contao-legacy/efg": ">=2.2.1.9005,<2.3-dev",
    "contao-legacy/om_searchkeys": "~1.0",
    "contao-legacy/rocksolid-columns": ">=1.0.6.9006,<1.1-dev",
    "contao-legacy/semantic_html5": ">=1.1.7.9014,<1.2-dev",
    "contao-legacy/survey_ce": "3.0.2.9003",
    "imi/imi_mm_changelanguage": "*",
    "jakeasmith/http_build_url": "^1",
    "madeyourday/contao-rocksolid-columns": ">=1.0.7.0,<1.1-dev",
    "metamodels/bundle_all": "dev-master",
    "phpoffice/phpexcel": "dev-master",
    "psi/news4ward": ">=2.2.3.0,<2.3-dev",
    "psi/news4ward_archive-menu": "2.0.8",
    "psi/news4ward_author-menu": "2.0.2",
    "psi/news4ward_comments": "2.1.0",
    "psi/news4ward_metatitle": "dev-master#d2c09fb47441c05011ddcc5b08e54aae138a8ab7",
    "psi/news4ward_mostread": "2.1.0",
    "psi/news4ward_multicategories": "1.0.5",
    "psi/news4ward_related": "2.1.0",
    "psi/news4ward_tags": "2.1.1",
    "contao-community-alliance/dc-general": "^2.0.0-beta32",
    "querypath/QueryPath": "^3.0",
    "terminal42/contao-changelanguage": "^3.1",
    "contao-community-alliance/composer-client": "~0.14",
    "delahaye/dlh_googlemaps": "^2.2",
    "contao-legacy/inputvar": "1.1.1.9048"
    },
    "prefer-stable": true,
    "minimum-stability": "dev",
    "config": {
    "preferred-install": "dist",
    "cache-dir": "cache",
    "component-dir": "../assets/components"
    },
    "repositories": [
    {
        "type": "artifact",
        "url": "packages"
    },
    {
        "type": "composer",
        "url": "https://legacy-packages-via.contao-community-alliance.org/"
    }
    ],
    "extra": {
    "contao": {
        "migrated": "done"
    }
    }
}

Solution

  • Copying your composer.json to a local file, removing the artifact repository from it, and running composer install results in a message that legacy/survey_ce 3.0.2.9003 cannot be found. However, 3.0.2.9005 is reported to be available, so I continue with that.

    Running composer install again results in a resolvable set of dependencies. Running your composer require command again results in the same error message you got. I assume I am in the same spot now.

    Running composer show to list all installed packages reveals that the offending package is already installed in version 3.3.10.

    menatwork/contao-multicolumnwizard               3.3.10             MultiColumWizard for Contao OpenSource CMS
    

    That explains why the dependency could not be installed, because Composer usually does not make downgrades of packages that already are installed. However, the hints being given fom it are not really explaining what is going on.

    As I mentioned in my comment, you should try to overhaul your dependencies immediately:

    1. You are depending on fixed versions. Check if you can relax the version numbers to allow for compatible updates. This is easiest if the library authors state that they support semantic versioning, and it also is easy if they state that they explicitly NOT support it if they also state how to get to patches.
    2. You are depending on dev-master versions. Depending on branches will break your project at some point! Check if the library you are using has released tagged versions. Check which version you are currently referencing closest. Change your dependency from dev-master to that version (including compatible updates, as discussed in the first point) and see if your project still works.
    3. You are also depending on abandoned versions. You should upgrade the dependency to the package referenced - however this is by no means guaranteed to be an effortless transformation, some changes might be required. But it will help reduce the amount of packages involved, because it seems like many of the contao-legacy libs are re-released as menatwork, and do get updates. And these libraries should be able to be switched.