Question

I want to use the SilverStripe module "sheadawson/silverstripe-blocks dev-master". When i install it with composer, i was required to install some modules like multivaluefield and so fort. I installed them without a problem. Now i get the following terminal output:

Pascal@Nemesis:~/Sites/xyz$ composer require sheadawson/silverstripe-blocks dev-master
./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 silverstripe/cms 1.0.0 -> satisfiable by silverstripe/cms[1.0.0].
- sheadawson/silverstripe-blocks dev-master requires silverstripe/cms 3.1.* -> satisfiable by silverstripe/cms[3.1.0, 3.1.1, 3.1.2].
- Can only install one of: silverstripe/cms[3.1.0, 1.0.0].
- Can only install one of: silverstripe/cms[3.1.1, 1.0.0].
- Can only install one of: silverstripe/cms[3.1.2, 1.0.0].
- Installation request for sheadawson/silverstripe-blocks dev-master -> satisfiable by sheadawson/silverstripe-blocks[dev-master].

I can see, that the 3.1.* dependency leads to 3 possible versions. But the 1.0.0 version of the cms entangles me a bit since i have nowhere a dependency to this version.

When i want to install version 3.1.2 with

composer require silverstripe/cms 3.1.2

i get the following output:

Pascal@Nemesis:~/Sites/xyz$ composer require silverstripe/cms 3.1.2
./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 silverstripe/cms 1.0.0 -> satisfiable by silverstripe/cms[1.0.0].
- Can only install one of: silverstripe/cms[3.1.2, 1.0.0].
- Installation request for silverstripe/cms 3.1.2 -> satisfiable by silverstripe/cms[3.1.2].

The content of my composer.json file looks like that:

{
    "name": "silverstripe/cms",
    "type": "silverstripe-module",
    "description": "The SilverStripe Content Management System",
    "homepage": "http://silverstripe.org",
    "license": "BSD-3-Clause",
    "keywords": ["silverstripe", "cms"],
    "authors": [
        {
            "name": "SilverStripe",
            "homepage": "http://silverstripe.com"
        },
        {
            "name": "The SilverStripe Community",
            "homepage": "http://silverstripe.org"
        }
    ],
    "require": {
        "php": ">=5.3.2",
        "ajshort/silverstripe-gridfieldextensions": "dev-master",
        "silverstripe/multivaluefield": "dev-master"
    }
}

Does anybody know why composer wants to install version 1.0.0 of the cms as well? I tried already removing all modules, cleaning the composer.json, removing the composer.lock, composer update and everything else that came to my mind.

Was it helpful?

Solution

That composer.json of yours does look like it is the file from that CMS, not from your own software.

And if that is the case, it does not surprise me that Composer is confused. In that composer.json you state that "silverstripe/cms" is YOUR software. And if you tagged your software as version 1.0.0, you created "silverstripe/cms 1.0.0" - any required software that needs a higher version cannot work now.

Generally, if you start using Composer, it is good idea to run composer init in the main directory of your software and then answer some questions about YOUR software interactively.

In the most basic case, you create an empty file composer.json, and add a pair of curly braces, and then fill in a "require" key and the software needed.

What you should NEVER do: Copy the composer.json from anyone else without fixing all the issues. I don't know what you did to grab your current version, but I guess you probably cloned some repository to get your project started. That's not completely wrong - but somebody should improve that workflow then to avoid getting in trouble with Composer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top