To anyone affected by this, read comment #3 below.

Original Report

https://github.com/composer/composer/blob/master/CHANGELOG.md

Composer behavior change issue: https://github.com/composer/composer/pull/7454

1.7.3 2018-11-01
Fixed handling of replace/conflict rules. This may affect dependency resolution in some edge cases.

When trying anything with composer like update / require / remove:

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

  Problem 1
    - don't install drupal/core 8.6.3|remove drupal/drupal dev-dev
    - remove drupal/drupal dev-dev|remove drupal/core 8.6.3
    - Installation request for drupal/drupal dev-dev -> satisfiable by drupal/drupal[dev-dev].
    - Installation request for drupal/core (installed at 8.6.3) -> satisfiable by drupal/core[8.6.3].

My full composer.json:

{
    "name": "drupal/drupal",
    "description": "Drupal is an open source content management platform powering millions of websites and applications.",
    "type": "project",
    "license": "GPL-2.0+",
    "require": {
        "composer/installers": "^1.0.21",
        "wikimedia/composer-merge-plugin": "~1.3",
        "drupal/admin_toolbar": "^1.18",
        "drupal/adminimal_admin_toolbar": "^1.3",
        "drupal/console": "~1.0",
        "drupal/config_partial_export": "^1.4",
        "drupal/config_split": "^1.2",
        "drupal/paragraphs": "^1.1",
        "drupal/video": "^1.2",
        "drupal/cookieconsent": "^1.1",
        "drupal/webform": "^5.0-beta4",
        "drupal/devel": "^1.2",
        "drupal/field_group": "^1.0",
        "drupal/email_registration": "1.x-dev",
        "drupal/field_permissions": "1.x-dev",
        "drupal/masquerade": "2.x-dev",
        "drupal/auto_entitylabel": "2.x-dev",
        "drupal/administerusersbyrole": "2.x-dev",
        "drupal/clientside_validation": "^1.0",
        "drupal/core": "^8.6.0",
        "drupal/search_api": "^1.4",
        "drupal/adminimal_theme": "^1.3",
        "drupal/maxlength": "1.x-dev",
        "drupal/taxonomy_access_fix": "^2.0",
        "drupal/twig_tweak": "^1.5",
        "drupal/twitter_block": "3.x-dev",
        "drupal/better_exposed_filters": "^3.0@alpha",
        "drupal/easy_breadcrumb": "^1.6",
        "drupal/pathauto": "^1.0",
        "drupal/metatag": "^1.0",
        "drupal/password_policy": "^3.0-alpha3",
        "drupal/simple_sitemap": "^2.8",
        "drupal/smart_trim": "^1.0",
        "drupal/focal_point": "^1.0@beta",
        "drupal/editor_advanced_link": "^1.4",
        "drupal/chosen": "^2.2",
        "drupal/computed_field": "2.x-dev",
        "drupal/inline_entity_form": "1.x-dev",
        "drupal/reroute_email": "1.x-dev",
        "drupal/allowed_formats": "^1.1",
        "drupal/imce": "^1.5",
        "drupal/simple_styleguide": "1.x-dev",
        "drupal/rabbit_hole": "1.x-dev",
        "drupal/video_embed_field": "^1.5",
        "drupal/view_unpublished": "1.x-dev",
        "drupal/menu_firstchild": "1.x-dev",
        "drupal/menu_admin_per_menu": "1.x-dev",
        "drupal/recaptcha": "^2.2",
        "ddeboer/vatin": "^2.0",
        "drupal/swiftmailer": "1.x-dev",
        "drupal/mass_pwreset": "^1.0@alpha",
        "drupal/redirect": "^1.2",
        "drupal/shield": "^1.1",
        "drupal/node_view_permissions": "1.x-dev",
        "drupal/events_log_track": "^1.1",
        "drupal/google_analytics": "^2.2",
        "drupal/diff": "^1.0@RC",
        "drupal/address": "^1.4",
        "drupal/views_data_export": "^1.0@beta",
        "drupal/telephone_formatter": "^1.0@beta",
        "drupal/telephone_validation": "^2.1",
        "drupal/contribute": "^5.0@beta"
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "preferred-install": "dist",
        "autoloader-suffix": "Drupal8"
    },
    "extra": {
        "_readme": [
            "By default Drupal loads the autoloader from ./vendor/autoload.php.",
            "To change the autoloader you can edit ./autoload.php."
        ],
        "merge-plugin": {
            "include": [
                "core/composer.json"
            ],
            "recurse": false,
            "replace": false,
            "merge-extra": false
        },
        "installer-paths": {
            "core": ["type:drupal-core"],
            "libraries/{$name}": ["type:drupal-library"],
            "modules/contrib/{$name}": ["type:drupal-module"],
            "profiles/contrib/{$name}": ["type:drupal-profile"],
            "themes/contrib/{$name}": ["type:drupal-theme"],
            "drush/contrib/{$name}": ["type:drupal-drush"]
        }
    },
    "autoload": {
        "psr-4": {
            "Drupal\\Core\\Composer\\": "core/lib/Drupal/Core/Composer"
        }
    },
    "scripts": {
        "pre-autoload-dump": "Drupal\\Core\\Composer\\Composer::preAutoloadDump",
        "post-autoload-dump": "Drupal\\Core\\Composer\\Composer::ensureHtaccess",
        "post-package-install": "Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup",
        "post-package-update": "Drupal\\Core\\Composer\\Composer::vendorTestCodeCleanup"
    },
    "repositories": {
        "drupal": {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        "jqueryvalidate": {
            "type": "package",
            "package": {
                "name": "jqueryvalidate",
                "version": "1.15.0",
                "type": "drupal-library",
                "dist": {
                    "url": "https://jqueryvalidation.org/files/jquery-validation-1.15.0.zip",
                    "type": "zip"
                }
            }
        }
    },
    "require-dev": {
        "drupal/rules": "3.x-dev"
    }
}

Comments

Pascal- created an issue. See original summary.

Pascal-’s picture

Confirmed that this does work with Composer 1.7.2
It does not work with Composer 1.7.3 or 1.8.0

C:\Users\myname\Documents\projects\project\www (dev -> origin/matching)
λ composer -V
Composer version 1.7.2 2018-08-16 16:57:12

C:\Users\myname\Documents\projects\project\www (dev -> origin/matching)
λ composer update nothing
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files
> Drupal\Core\Composer\Composer::preAutoloadDump
> Drupal\Core\Composer\Composer::ensureHtaccess

C:\Users\myname\Documents\projects\project\www (dev -> origin/matching)
λ lando composer -V
Composer version 1.8.0 2018-12-03 10:31:16

C:\Users\myname\Documents\projects\project\www (dev -> origin/matching)
λ lando composer update nothing
1/2:        https://packages.drupal.org/8/drupal/provider-2018-4$4578a5d751ca0ec05f7ba6c174385ec4844b787e5186c86f32b73618eb387a7b.json
2/2:        https://packages.drupal.org/8/drupal/provider-2018-3$f0e771658f6bc3195f53a63708f67797c5d8dc32a24286fffaf7becaea38363b.json
Finished: success: 2, skipped: 0, failure: 0, total: 2
1/4:        http://repo.packagist.org/p/provider-latest$7d677fea049c0886e0ab025512c61b8e9e5e23486da757bb09ef95fd345894e9.json
2/4:        http://repo.packagist.org/p/provider-2018-07$726ab4f2a5ace4dee13a39e23b4d56a883f5a9f8d23b31dcf7762a7240ef3676.json
3/4:        http://repo.packagist.org/p/provider-2017$1c26853e8ffa0637caca7bc2fd54b4fffd3b566579b72e7b835831dda89701e0.json
4/4:        http://repo.packagist.org/p/provider-2018-10$371d16217342bd127eb08bb1c96fbce0d1d8753e8042f4030cc8b5e685ef1ab5.json
Finished: success: 4, skipped: 0, failure: 0, total: 4
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
- don't install drupal/core 8.6.3|remove drupal/drupal dev-dev
- remove drupal/drupal dev-dev|remove drupal/core 8.6.3
- don't install drupal/core 8.6.3|remove drupal/drupal dev-dev
- Installation request for drupal/drupal dev-dev -> satisfiable by drupal/drupal[dev-dev].
- Installation request for drupal/core (locked at 8.6.3, required as ^8.6.0) -> satisfiable by drupal/core[8.6.3].


C:\Users\myname\Documents\projects\project\www (dev -> origin/matching)
cilefen’s picture

Why is "core/composer.json" in the merge plugin configuration? I think we used to promote that but I had to remove it to proceed.

berdir’s picture

Trying to work with a normal drupal installation (drupal/drupal) was always very problematic, I would strongly recommend you convert to https://github.com/drupal-composer/drupal-project. This might change again as composer support is improved, but it is for now far more reliable.

cilefen’s picture

True.

As for the immediate issue, #3 will likely fix this for you. And at this stage, you could change the name value to myorg/project_name because you in fact "own" this composer.json now. It isn't drupal/drupal.

There is not a reason to merge core/composer.json because Drupal's dependencies have already been worked out by requiring drupal/core. And it looks like this now makes it impossible to composer install. Other people will encounter this problem.

Pascal-’s picture

Confirmed that #3 solves this.

Removed the following from my composer.json:

        "merge-plugin": {
            "include": [
                "core/composer.json"
            ],
            "recurse": false,
            "replace": false,
            "merge-extra": false
        },

Should we patch this?

cilefen’s picture

Title: Composer version 1.7.3 changed dependency resolution causing "Your requirements could not be resolved to an installable set of packages" » Composer versions >=1.7.3 returns "Your requirements could not be resolved to an installable set of packages" when core/composer.json is included in the merge plugin configuration
Category: Bug report » Support request
Issue summary: View changes
Related issues: +#3020337: Composer returns "Your requirements could not be resolved to an installable set of packages" when core/composer.json is included in the merge plugin configuration
cilefen’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

tea.time’s picture

@cilefen I am guessing you meant #2912387: Stop using wikimedia/composer-merge-plugin in #7 :)

cilefen’s picture

cilefen’s picture

Title: Composer versions >=1.7.3 returns "Your requirements could not be resolved to an installable set of packages" when core/composer.json is included in the merge plugin configuration » Composer returns "Your requirements could not be resolved to an installable set of packages" when core/composer.json is included in the merge plugin configuration
cilefen’s picture

Issue summary: View changes
firfin’s picture

While searching for a solution to my problem I keep running into this issue. So although it's old I am still asking my question here, hoping somebody can clear this up. For me and all those who suffer through this after me, so:

For people still running into this, is @berdir's comment in #4 still relevant?

I would strongly recommend you convert to https://github.com/drupal-composer/drupal-project.

And if so, is there a guide on how to 'convert' ?

And if not, what is the recommended course now?
Even or especially when coming from a 'drupal/drupal' install?

mmjvb’s picture

For people still running into this, is @berdir's comment in #4 still relevant?

Sort of, yes. The actual issue reported by composer is an error in your specifications. Bad use of merge plugin: don't have drupal/core both in require and merge-plugin. Either in require or in merge-plugin. Unfortunately, when in merge-plugin it is not updatable with `composer update` like dependencies mentioned in require.
This is why it changed for most project templates. At least those meant for starting a site.

And if so, is there a guide on how to 'convert' ?

Not aware of a guide, instructions already provided here in this issue. But, consider them incomplete. Suggest to start with a decent template and merge the require section into it.

And if not, what is the recommended course now?
Even or especially when coming from a 'drupal/drupal' install?

Start new with your site. Keep the drupal/drupal site for development. Don't try to turn it into a site.

firfin’s picture

Thanks, for your clarification @mmjvb
Unfortunately, this IS already a site. So updating is a necessity, although almost seemingly impossible.

But I will try starting 'with a decent template and merge the require section' on a fresh server.
I guess I best start with locking versions to the current versions then also?

And when 'converted' to a modern / normal ( i.e. drupal/recommended-project) installation I can then update normally I assume?

berdir’s picture

> Unfortunately, this IS already a site

Creating a new "site" in this case means creating a new code base, from a clean composer template, then you add all your contrib modules/themes, copy over the all custom code including files and settings.php. So in the end it is the same site, you just rebuilt the code base.

If you've never done that before, you might want to try to set up a new project with it first, so you can get used to it, a few things are different, for example your webserver needs to point to the web/ directory.

mmjvb’s picture

Once converted to proper template you should be able to update normally. That does assume you are not locking anything. Your version requirements should allow for patch releases as a minimum. You might allow minor updates, selectively or in general. There is no need for pinning down to particular versions. Keeping current should be your objective, migrating to latest versions when possible.

Don't forget that a proper template consists of more than just a composer.json with a require section.

firfin’s picture

Thanks for the further explanations @Berdir and @mmjvb , this gave me the courage and understanding to proceed.
In the end it all went smoother than I feared.
For future reference:
- create a new site with: composer create-project drupal/recommended-project
- merge in the old composer.json, especially the required section. Some care is needed as some packages are no longer needed (e.g. wikimedia/composer-merge-plugin). Also take a good look at which version of modules you want to use and if there is an upgrade path from the older version to a new one. Or if there is some manual migration of settings needed.
- composer update
- copy old 'files' dir and possibly patches (better yet get the patches into composer.json with cweagans/composer-patches)
- copy over old database
- drush updb
- drush cr
- enjoy shiny new updated site!

mmjvb’s picture

You could improve by:
- use --no-install on create-project
- adjust require section
-- add from original project
-- remove undesired from new project
- run composer install

The benefit is that there is less chance of conflicting dependencies. The requirements are resolved when they are complete rather than in two steps.

aswathyajish’s picture

I also have the same issue.

My composer version is 2.0.6.

Any solution to this?

cilefen’s picture

@AswathyAjish Did you read the issue and comments?