Solution to the problem reported below

See #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.

Original report

Hi,

When I trying to update Drupal core to 8.7.0 using composer I am getting the following error.

$ composer require drupal/core:8.7.0 --update-with-dependencies

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

Problem 1
- Can only install one of: egulias/email-validator[2.0.x-dev, 1.2.14].
- Can only install one of: egulias/email-validator[2.0.x-dev, 1.2.14].
- Can only install one of: egulias/email-validator[2.0.x-dev, 1.2.14].
- drupal/core 8.7.0 requires egulias/email-validator ^2.0 -> satisfiable by egulias/email-validator[2.0.x-dev].
- Installation request for drupal/core 8.7.0 -> satisfiable by drupal/core[8.7.0].
- Installation request for egulias/email-validator (locked at 1.2.14, required as ^1.2) -> satisfiable by egulias/email-validator[1.2.14].

When I try to update the egulias/email-validator[ package separately it shows:
$ composer require egulias/email-validator:2.0.1 --update-with-dependencies

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

Problem 1
- Installation request for egulias/email-validator 2.0.1 -> satisfiable by egulias/email-validator[2.0.1].
- Can only install one of: egulias/email-validator[2.0.1, 1.2.x-dev].
- Installation request for egulias/email-validator ^1.2 -> satisfiable by egulias/email-validator[1.2.x-dev].

Drupal 8.6.15 reqquires email-validator with ^1.2 version and 8.7.0 requires ^2.0 email-validator.

Any solution? help please.

Comments

Karthikavn created an issue. See original summary.

xjm’s picture

Title: Cannot update to Drupal 8.7.0 from 8.6.15 » Cannot update to Drupal 8.7.0 from 8.6.15 -- egulias/email-validator version conflict
maskedjellybean’s picture

I'm sorry I don't have an answer, but I'm facing the same issue. We seem to be stuck in a loop here.

maskedjellybean’s picture

Oh wow. I found a solution. I'm sure it is not the correct solution but it does work. From within your drupal directory, open core/composer.json.

Search for "egulias/email-validator". Change the version to "^2.0".

Run composer update egulias/email-validator drupal/core --with-dependencies

So many wasted hours chasing down why Composer does not update.

cilefen’s picture

Category: Bug report » Support request
Priority: Critical » Normal

If egulias/email-validator is specified in your composer.json, you have to do something like #4.

websiteworkspace’s picture

This problem is occurring when - egulias/email-validator - is not in the composer.json!

The fact that this problem is occurring implies a problem buried deep in the package dependency lists in drupal core.

composer is issuing the following nonsense sorts of responses after trying every variation imaginable!
Note that: egulias/email-validator is NOT in the composer.json prior to the command!


composer.phar require egulias/email-validator drupal/core
Using version ^2.1 for egulias/email-validator
Using version ^8.7 for drupal/core
./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
    - Can only install one of: egulias/email-validator[2.1.0, 1.2.x-dev].
    - Can only install one of: egulias/email-validator[2.1.1, 1.2.x-dev].
    - Can only install one of: egulias/email-validator[2.1.2, 1.2.x-dev].
    - Can only install one of: egulias/email-validator[2.1.3, 1.2.x-dev].
    - Can only install one of: egulias/email-validator[2.1.4, 1.2.x-dev].
    - Can only install one of: egulias/email-validator[2.1.5, 1.2.x-dev].
    - Can only install one of: egulias/email-validator[2.1.6, 1.2.x-dev].
    - Can only install one of: egulias/email-validator[2.1.7, 1.2.x-dev].
    - Installation request for egulias/email-validator ^1.2 -> satisfiable by egulias/email-validator[1.2.x-dev].
    - Installation request for egulias/email-validator ^2.1 -> satisfiable by egulias/email-validator[2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.1.5, 2.1.6, 2.1.7].


Installation failed, reverting ./composer.json to its original content.


websiteworkspace’s picture

HERE IS A HACK TO RESOLVE THIS ANNOYING PROBLEM!

While working on this update problem, I finally remembered that similar sorts of nonsense occurs with nearly every update from x.y.* to x.z.* version (for example 8.6.x to 8.7.x).

I even built a shell script a while ago that performs all the required steps.

Do the following:
0) create a full site backup
1) delete the core and vendor directories
2) delete the composer.lock file
3) edit the composer.json to hard code the desired drupal core version (such as 8.7.1 in this instance)
3) run - composer update (update everything)
- - since the core and vendor directories don't exist, composer will recreate them with all new contents
4) run - drush -n -y updb (does database updates)
5) run - drush -n -y cr (rebuilds the site code/cache)
6) test the site
7) re-edit composer.json to "^8.7" for the drupal core version.

cilefen’s picture

The composer subcommand to use is ‘why-not drupal/core:8.7.1’ if memory serves. Yes the messages are impossible to interpret sometimes.

P.S. For more help post composer.json and composer.lock so some of us have even a chance to recreate the problem and to help. I think I’ll make that my policy from now on.

portulaca’s picture

I changed the desired Drupal version in composer.json with composer require [...] --no-update as suggested here: https://www.drupal.org/project/drupal/issues/3052057#comment-13094021 and it worked, the update went through, and the egulias/email-validator was updated in the process.

Is there a better way to state the desired Drupal version in composer.json so it doesn't have to be changed this way between minor versions?

@cilefen I posted some info in the comment below the one I linked to. I'm repeating it here:

Prohibits (why-not):

$ composer prohibits drupal/core 8.7.0
drupal-composer/drupal-project  dev-master  requires          drupal/core (~8.6.0)                               
webflo/drupal-core-require-dev  8.6.16      requires          drupal/core (8.6.16)                               
drupal/core                     8.7.0       requires          egulias/email-validator (^2.0)                     
drupal-composer/drupal-project  dev-master  does not require  egulias/email-validator (but 1.2.15 is installed)

How I fixed it:

composer require drupal/core:~8.7.0 --no-update
composer require webflo/drupal-core-require-dev:~8.7.0 --no-update
composer update drupal/core webflo/drupal-core-require-dev --with-dependencies --dry-run
composer update drupal/core webflo/drupal-core-require-dev --with-dependencies 
cd web
[../vendor/bin/]drush updatedb
[../vendor/bin/]drush cr
websiteworkspace’s picture

@cilefen

This problem is not created by specifics in a site level composer.json.

This problem is created by problems deep within the package dependencies of drupal core itself.

This particular package conflict occurs because 8.6.16 wants and installs egulias/email-validator (^1.2) - but - drupal/core 8.7.x wants egulias/email-validator (^2.1)

(note the results of the following composer command when core 8.6.16 is installed)


composer.phar depends egulias/email-validator
drupal/core  8.6.16  requires  egulias/email-validator (^1.2)

(note the results of the following composer command when core 8.6.16 is installed)


composer.phar show egulias/email-validator
name     : egulias/email-validator
descrip. : A library for validating emails
keywords : email, emailvalidation, emailvalidator, validation, validator
versions : * 1.2.15
type     : library
license  : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
source   : [git] https://github.com/egulias/EmailValidator.git 758a77525bdaabd6c0f5669176bd4361cb2dda9e
dist     : [zip] https://api.github.com/repos/egulias/EmailValidator/zipball/758a77525bdaabd6c0f5669176bd4361cb2dda9e 758a77525bdaabd6c0f5669176bd4361cb2dda9e
names    : egulias/email-validator

autoload
psr-0
Egulias\ => src/

requires
doctrine/lexer ^1.0.1
php >= 5.3.3

requires (dev)
phpunit/phpunit ^4.8.24


(then a composer update attempt outputs the following error(s)


composer.phar update --dry-run
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 egulias/email-validator ^1.2 -> satisfiable by egulias/email-validator[1.2.0, 1.2.1, 1.2.10, 1.2.11, 1.2.12, 1.2.13, 1.2.14, 1.2.15, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.2.6, 1.2.7, 1.2.8, 1.2.9, 1.2.x-dev].
    - drupal/core 8.7.1 requires egulias/email-validator ^2.0 -> satisfiable by egulias/email-validator[2.0.x-dev].
    - drupal/core 8.7.x-dev requires egulias/email-validator ^2.0 -> satisfiable by egulias/email-validator[2.0.x-dev].
    - drupal/core 8.8.x-dev requires egulias/email-validator ^2.0 -> satisfiable by egulias/email-validator[2.0.x-dev].
    - Conclusion: don't install egulias/email-validator 2.0.x-dev
    - Installation request for drupal/core ^8.7.1 -> satisfiable by drupal/core[8.7.1, 8.7.x-dev, 8.8.x-dev].


Every recent major core update has contained a dependency problem like this that can only be overcome by deleting the composer.lock, /core, /vendor, and then running composer update, upon which composer rebuilds all /core and /vendor contents from scratch.

websiteworkspace’s picture

Here is the output of the composer analysis command suggested by @cilefen.

(note that the drupal core version when running the command below is 8.6.16)


composer.phar  why-not drupal/core:8.7.1
drupal/core    8.7.1  requires  egulias/email-validator (^2.0)
drupal/drupal  -      requires  egulias/email-validator (^1.2)

cilefen’s picture

@websiteworkspace Do you have the Composer merge plugin configured to merge core/composer.json? If so, you should not.

cilefen’s picture

I'm just guessing because you have not posted the files...

websiteworkspace’s picture

HACK TO SOLVE THIS PROBLEM

Assuming that there aren't any other package dependency problems, the following command in a shell script file will work around the catch22 created by the egulias/email-validator version requirements in the source and target drupal core versions.


# assumes PWD == drupal site root - and that the non-standard directory setup created by some non-standard site installers doesn't exist
# assumes use of php.ini in ~/ to workaround differing local php.ini settings
/bin/rm -f -r $PWD/vendor/.[^.]*
/bin/rm -f -r $PWD/vendor/*

/bin/rm -f -r $PWD/core/.[^.]*
/bin/rm -f -r $PWD/core/*

/bin/rm -f -r $PWD/composer.lock

php -c ~/php.ini composer.phar update

php -c ~/php.ini vendor/bin/drush -n -y updb

php -c ~/php.ini vendor/bin/drush -n -y cr



or


# assumes PWD == drupal site root - and that the non-standard directory setup created by some non-standard site installers doesn't exist
/bin/rm -f -r $PWD/vendor/.[^.]*
/bin/rm -f -r $PWD/vendor/*

/bin/rm -f -r $PWD/core/.[^.]*
/bin/rm -f -r $PWD/core/*

/bin/rm -f -r $PWD/composer.lock

composer.phar update

drush -n -y updb

drush -n -y cr


websiteworkspace’s picture

@cilefen wrote

@websiteworkspace Do you have the Composer merge plugin configured to merge core/composer.json? If so, you should not.

Please expound and clarify, including an explanation of "If so, you should not.", explaining why not.

cilefen’s picture

#11 and #2912387: Stop using wikimedia/composer-merge-plugin explain in a way why not and in fact this particular problem didn't become a problem until some (I don't remember which) version of Composer.

I'm guessing (still haven't seen the files!) that the 'name' key in composer.json is 'drupal/drupal', right? #11 is basically saying that composer.json that drupal/core (from Packagist or whatever) conflicts with the core/composer.json that is currently sitting there, because it is being merged into the site's own composer.json (aka drupal/drupal).

websiteworkspace’s picture

@cilefen

I just downloaded the 8.7.1 base core package from the following link:

https://www.drupal.org/project/drupal/releases/8.7.1

The default composer.json included in the archive at the link just above includes the:


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

directives.

However, @cilefen, your post tersely implies that this "should not" be used, but without explanation.

Please provide an explanation, and please include links / citation of documentation that documents the various behaviors of these directives.



{
    "name": "drupal/drupal",
    "description": "Drupal is an open source content management platform powering millions of websites and applications.",
    "type": "project",
    "license": "GPL-2.0-or-later",
    "require": {
        "composer/installers": "^1.0.24",
        "wikimedia/composer-merge-plugin": "^1.4"
    },
    "replace": {
        "drupal/core": "^8.7"
    },
    "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.",
            "This file specifies the packages.drupal.org repository.",
            "You can read more about this composer repository at:",
            "https://www.drupal.org/node/2718229"
        ],
        "merge-plugin": {
            "include": [
                "core/composer.json"
            ],
            "recurse": true,
            "replace": false,
            "merge-extra": false
        },
        "installer-paths": {
            "core": ["type:drupal-core"],
            "modules/contrib/{$name}": ["type:drupal-module"],
            "profiles/contrib/{$name}": ["type:drupal-profile"],
            "themes/contrib/{$name}": ["type:drupal-theme"],
            "drush/contrib/{$name}": ["type:drupal-drush"],
            "modules/custom/{$name}": ["type:drupal-custom-module"],
            "themes/custom/{$name}": ["type:drupal-custom-theme"]
        }
    },
    "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",
        "drupal-phpunit-upgrade-check": "Drupal\\Core\\Composer\\Composer::upgradePHPUnit",
        "drupal-phpunit-upgrade": "@composer update phpunit/phpunit phpspec/prophecy symfony/yaml --with-dependencies --no-progress",
        "phpcs": "phpcs --standard=core/phpcs.xml.dist --runtime-set installed_paths $($COMPOSER_BINARY config vendor-dir)/drupal/coder/coder_sniffer --",
        "phpcbf": "phpcbf --standard=core/phpcs.xml.dist --runtime-set installed_paths $($COMPOSER_BINARY config vendor-dir)/drupal/coder/coder_sniffer --"
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ]
}



cilefen’s picture

The compressed download composer.json has to be modified in order to manage the site fully with Composer. This is still being worked out and yes, it has been messy. There are lots of issues about improving the state of play.

websiteworkspace’s picture

@cilefen

As I've just carefully documented in my most recent post, drupal core archive package continues to contain a composer.json that includes "merge-plugin" directives.

-

How does the "merge-plugin" directive impact the problem that I and others have experienced and documented, the basic composer updating problem which inspired the bug report that is under examination in this discussion thread?

websiteworkspace’s picture

If the "merge-plugin" directives are deprecated, why does the official drupal core archive, even as of today, continue to ship with a deprecated composer.json, which surely thousands of people are using as a gold standard for maintaining their sites with the composer utility?

cilefen’s picture

I just explained in #16 and linked to issues. I am trying to help you for free, with no appreciation but more demands of my time. The fact is that the current documentation recommends a different approach than downloading a compressed archive. That's new since you and I first installed Drupal 8 sites. See #19 about this being a messy process as 8 has evolved.

Issues exist like #2845378: Stop offering .tar.gz downloads, for example.

websiteworkspace’s picture

Only by accident or necessity after having a problem would one stumble upon the following page:

https://www.drupal.org/project/drupal/issues/3020337

More importantly, the discussion at the link just above DOES NOT fully explain the reasons for the problem or explain why the change is needed, i.e. including what behaviors occur with and/or without the directive in question.

websiteworkspace’s picture

The really annoying drupal file/directory setup created by the following really annoying configuration is not available to a huge portion of the drupal dev/user base!

https://www.drupal.org/docs/develop/using-composer/using-composer-to-ins...

Myself and tens of thousands other drupalers aren't/can't going to spend person years of work retooling existing person years of work built on the standard directory setup.

websiteworkspace’s picture

@cilefen

I believe that I have contributed significantly and generously to this thread, to hopefully help thousands of other drupalers who have experienced this problem, by providing a practical solution for updating existing drupal 8 code bases, and explanations of what and why the solutions I've suggested provide.

Also, and quite importantly, I too have provided those solutions for free to anybody who reads this thread.

cilefen’s picture

I explained it in #16. I feel like you think core contributors are doing this to you just for fun and I'm sorry you don't like it and continue sort-of yelling at me. And I can tell you are animated by this problem—and let me be clear I myself was "bitten" by this very issue—anyone can edit documentation, but in fact someone put in some work on https://www.drupal.org/docs/8/install/add-composer-to-an-existing-site. Just for the record, below is a composer.json what was converted from the default zip to Composer-managed. You may want to avoid webflo/drupal-core-strict unless you know you need it, as it introduces more stringent requirements and Composer knowledge when using.

{
    "name": "foo/foo",
    "type": "project",
    "license": "MIT",
    "require": {
        "composer/installers": "^1.0.21",
        "cweagans/composer-patches": "^1.6",
        "drupal-composer/drupal-scaffold": "^2.3",
        "drupal/academic_applications": "1.x-dev",
        "drupal/acquia_connector": "^1.16",
        "drupal/acquia_purge": "^1.0@alpha",
        "drupal/bootstrap": "^3.17",
        "drupal/cas": "^1.4",
        "drupal/core": "^8.7.1",
        "drupal/ctools": "^3.0",
        "drupal/honeypot": "^1.23",
        "drupal/imce": "^1.4",
        "drupal/masquerade": "^2.0@beta",
        "drupal/metatag": "^1.8",
        "drupal/purge": "^3.0@beta",
        "drupal/r4032login": "1.x-dev",
        "drupal/recaptcha": "^2.4",
        "drupal/token": "^1.0@beta",
        "drupal/webform": "^5.0@RC",
        "drush/drush": "^9.5",
        "webflo/drupal-core-strict": "^8.7.1",
        "wikimedia/composer-merge-plugin": "~1.3",
        "zaporylie/composer-drupal-optimizations": "^1.1"
    },
    "require-dev": {
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "config": {
        "preferred-install": "dist",
        "autoloader-suffix": "Drupal8",
        "platform": {
            "php": "7.2"
        },
        "sort-packages": true
    },
    "extra": {
        "_readme": [
            "By default Drupal loads the autoloader from ./vendor/autoload.php.",
            "To change the autoloader you can edit ./autoload.php."
        ],
        "merge-plugin": {
            "include": [
                "modules/custom/*/composer.json",
                "modules/contrib/webform/composer.libraries.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"],
            "modules/custom/{$name}": ["type:drupal-custom-module"],
            "themes/custom/{$name}": ["type:drupal-custom-theme"]
        }
    },
    "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": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        }
    ]
}
websiteworkspace’s picture

@cilefen

Based on your entirely arrogant and inappropriate comment as quoted below:

I feel like you think core contributors are doing this to you just for fun and I'm sorry you don't like it and continue sort-of yelling at me. And I can tell you are animated by this problem ...

You have some serious social interaction/perception problems, and possibly some social maturely problems as well.

You need to grow up and learn to stay focused on the code/coding problem and stop personalizing and getting your emotions involved, and/or incorrectly thinking/believing that anyone else is as ego and emotion involved as you are.

cilefen’s picture

Status: Active » Closed (duplicate)

If there is nothing further I am presently going to duplicate this onto #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. Its issue summary could use an update with a good explanation. Some prose from #16 would do.

mmjvb’s picture

@portulaca The version constraint ~8.7.0 keeps you within 8.7, allowing to go to 8.8 and 8.9 it should be ^8.7.0 or ~8.7.

My preference is ~8.7.0, making the change in minor a more conscious decision.

Our solution works for those that understand the difference between drupal/drupal and drupal-composer/drupal-project or any other proper distribution for site building. Not sure which distribution the OP is using. Looks like this issue has been hijacked !

cilefen’s picture

I think @portulaca is dealing with how to update in a webflo/drupal-core-require-dev context, which as far as I can tell is different than the OP's issue.

mmjvb’s picture

No, we are not dealing with the update in a webflo/drupal.... context.
As you can see we are dealing from an unknown context. Use "composer prohibits" to find out your context!
It happens to be webflo/drupal-core... that blocks, but you need to find out what blocks you because your project is unique. Depending on those blocks, you need to decide for option --with-dependencies or whitelisting blocking packages.
Or use --dry-run on "composer update" to see what gets updated. When you don't care about what gets updated, feel free to use "composer update". When you do, whitelist what needs updating.

In addition, make sure you are running most recent version of composer. Older versions are known to cause these issues.
"$ sudo composer selfupdate"

Karthikavn’s picture

Category: Support request » Bug report
Priority: Normal » Critical
Status: Closed (duplicate) » Active

Tried the solution #4 and it results:

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

Problem 1
- Installation request for egulias/email-validator ^2.0 -> satisfiable by egulias/email-validator[2.0.0, 2.0.1, 2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.1.5, 2.1.6, 2.1.7, 2.0.x-dev].
- drupal/core 8.6.15 requires egulias/email-validator ^1.2 -> satisfiable by egulias/email-validator[1.2.x-dev].
- drupal/core 8.6.15 requires egulias/email-validator ^1.2 -> satisfiable by egulias/email-validator[1.2.x-dev].
- drupal/core 8.6.15 requires egulias/email-validator ^1.2 -> satisfiable by egulias/email-validator[1.2.x-dev].
- Conclusion: don't install egulias/email-validator 1.2.x-dev
- Installation request for drupal/core 8.6.15 -> satisfiable by drupal/core[8.6.15].

Still waiting for a solution.

aburrows’s picture

Just stepping in here. This issue is starting to become personal and should not be in anyway. I to experience issues with composer and dependencies but there is no need to get personal with @cilefen
So can you @websiteworkspace please take a break from this issue and come back later on.

Please see https://www.drupal.org/dcoc for more on our code of conduct whilst using Drupal.org and interacting with others in the issue queue.

Alex - For and on behalf of Drupal community working group

Karthikavn’s picture

Tried the solution #7 by @websiteworkspace and it results:

Recoverable fatal error: Argument 2 passed to Drupal\\serialization\\Normalizer\\EntityNormalizer::__construct() must implement interface Drupal\\Core\\Entity\\EntityTypeRepositoryInterface, instance of Drupal\\hal\\LinkManager\\LinkManager given, called in /var/www/allofus-updates/core/lib/Drupal/Component/DependencyInjection/Container.php on line 277 and defined in /var/www/allofus-updates/core/modules/serialization/src/Normalizer/EntityNormalizer.php

handkerchief’s picture

#4 works for me. After the change in core/composer.json I had to execute this:

composer update egulias/email-validator symfony/http-foundation drupal/core --with-dependencies

Karthikavn’s picture

@handkerchief Can you please tell me what are the steps you follow to update the core? other than updating core/composer.json to

"egulias/email-validator": "^2.0"

And also can you please confirm, after the core update did you face any error like https://www.drupal.org/project/drupal/issues/3053583

The feedback should be appreciated.

handkerchief’s picture

Of course:

1. drush sset system.maintenance_mode 1

2. drush cr

3. Change your own composer.json of your drupal installation in the require section:

"drupal/core": "8.7.1",

But I guess ^8.7 will do it too.

4. Change core/composer.json

"egulias/email-validator": "^2.0"

5. Run composer update egulias/email-validator drupal/core --with-dependencies

6. If a composer error appears which report other projects, add this projects to your composer command.
e.g.
composer update egulias/email-validator symfony/http-foundation drupal/core --with-dependencies

7. If it worked, run drush updb and drush entity-updates

8. drush sset system.maintenance_mode 0

9. drush cr

Thats all. No error has appeared.

cilefen’s picture

If anyone has core/composer.json in the merge configuration, read #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 or this will happen to you again in the future.

Karthikavn’s picture

@handkerchief Thanks for the update.

I followed the same steps and it results Drupal core finally updated to 8.7.1. Thanks once again.

(The extra step I have done is to remove the composer.lock file)

But after the update, when I tested the site I got this error: https://www.drupal.org/project/drupal/issues/3053583.

Is that something you could help me out to resolve this issue?

Also which version of PHP are you using?

cilefen’s picture

Everyone: Please read the P.S. in #8. These files vary by site. Attach them in a comment if you experience difficulty upgrading.

Karthikavn’s picture

Issue tags: +PHP 7.3
handkerchief’s picture

Watch out: On another instance I additionally had this problem #3040129: Fatals in make_menu_link_content_revisionable when combined with make_taxonomy_term_revisionable with this solution:
https://www.drupal.org/project/drupal/issues/3040129#comment-13096630

@Karthikavn sorry for this error, I'm afraid I really don't know. I'm using PHP 7.2.17. I hope you will find help from the community in the other issue #3053583: Drupal core update 8.7.1 throws an error in Drupal\\serialization\\Normalizer\\EntityNormalizer

unsettlingtrend’s picture

#37 worked for me. Also want to voice my opinion that it's a huge pain constantly dealing with issues when updating drupal/core through composer.

Karthikavn’s picture

@handkerchief Thanks for update. Your comments really helpful for me.

cilefen’s picture

mxr576’s picture

zorax’s picture

@handkerchief Thanks for this clear update! You save my time !

alienzed’s picture

I was ultimately able to resolve this by download Drupal core and uploading it manually, at which point I ran into composer.lock preventing the update. After manually updating the version of egulias/email.... and re-running composer up, it worked. What I don't understand is the following.

the core/composer.json for 8.7 specifies the newer version of egulias/email..., but it seems like composer up checks the old (8.6) composer.json for versions and decides 8.7 won't like what is installed. Why doesn't the 8.7 composer.json, which would get a new core/composer.json with the right requirements take precedence? My project doesn't require egulias/email... itself, it is a requirement of Core.

It seems like manually updating composer.lock is a bad thing to do, but that's what I need to do to get this working. Shouldn't requirements be met in order? Like, first core/composer.json requirements and then up?

cilefen’s picture

See #45. I feel like a broken record. It may apply to you.

NatDevD’s picture

@handkerchief Thank you very much indeed, that worked for me too.
Specifically, when updating from the latest 8.6 to 8.7.1, for your step #6 I needed to do:
composer update egulias/email-validator drupal/core webflo/drupal-core-require-dev --with-dependencies

@cilefen @websiteworkspace and all others, your contribrutions are appreciated.

cilefen’s picture

Category: Bug report » Support request
Priority: Critical » Normal

I am converting this now to a support request because every issue to date has been about understanding the upgrade commands needed for drupal-project (as of this moment, supported on GitHub), or, #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. More importantly, no commit to Drupal Core is likely to result from this issue. And there are major initiatives and issues open elsewhere to facilitate Composer use in Drupal.

But I will leave this open for further discussion. Thanks everyone for sharing tips.

makazimtingwa’s picture

After trying all the options listed here and failing, the only thing that worked for me was to remove the following from my composer.json file

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

After the upgrade work, I placed the section back in composer.json. I'm concerned something will break in the future with the missing section.

cilefen’s picture

Merging core/composer.json will only cause problems. Take it out.

remyyyyy’s picture

@cilefen Thank you very much, that worked for me.

Anitta’s picture

update composer.json
If your current version is 8.x(below 8.6.16), then upgrade to 8.6.16
"drupal/core": "8.6.16"
If the composer update shows an error related to this module "egulias/email-validator"
"egulias/email-validator": "^2.0" - Add this to your composer.json or edit the existing version
run composer update
check your composer version upgrade it to 1.8
edit composer.json "drupal/core": "8.7.1",
rename folders core and vendor
run composer install

It worked for me

mingsong’s picture

#7 works to me.

kirkkala’s picture

I got past this issue with updating 8.6.16 -> 8.7.1, inspired by #4:

  1. Modify core/composer.json by changing egulias/email-validator" to "^2.0"
  2. Delete vendor directory
  3. composer update egulias/email-validator symfony/http-foundation drupal/core --with-dependencies
cilefen’s picture

I wish that #16, #45, #51 would inspire people because they represent the correct fix. If you find yourself editing core/composer.json, you are not really fixing the problem.

_san_’s picture

#59 worked for me!

mmjvb’s picture

@ssteigen Good for you. Do you also understand why it is wrong?

SpursFan’s picture

@mmjvb Ok i'll ask..I'm new to Drupal. I am having the exact same issue, composer update will not update. I am tempted to go #59's route. But everything inside me says never edit core files. is it safe to do so in Drupal? Again sorry for my ignorance, as I'm new to Drupal. Thanks sir!

cilefen’s picture

Issue summary: View changes
mmjvb’s picture

You started with the wrong distribution! When you download the distribution of Drupal, you get something that is meant for software developers. NOT for site builders. For site building you require a different distribution. The package for software developers is different from those for site builders. In addition there are quite a few distributions for site builders. They all use drupal/core and drupal-composer/drupal-scaffold as requirement because they are needed when you want your site to update its code base.

For development the core/composer.json is integrated with the composer.json via the merge plugin. That is why drupal/core is mentioned in the replace section. Rather than having it included via drupal/core it is put in the package itself and replacing drupal/core. Moving it from the replace to the require section is causing problems when not removing it from the merge plugin.

Rather than trying to solve every issue at the time you are running into it, you can do things the right way from the start. Sure, there are developers that fully understand how the drupal/drupal package is designed to work and turn that into a package that can be used for site building. Considering the amount of issues that is not an easy job for a site builder. And proven difficult for developers as well. Start your project the right way and pick one of the available distributions or the popular package drupal-composer/drupal-project. They have been set up for site building and allow you to update the code base with composer.

Once started the right way you need to maintain your code base by following the instructions of that particular distribution. They have documented what you need to do for updating to a new version of their distribution. When you want to stay current in the mean time, use the composer commands below:
- composer outdated -Dm
- composer prohibits vendor/package version
- composer show vendor/package
- composer show vendor/package -a
- composer depends vendor/package -t
- composer outdated -m
- composer outdated
- composer update vendor/package --with-dependencies --dry-run
- composer require vendor/package:constraint --no-update
- composer update vendor/package vendor/package vendor/package

These commands allow you to find out whether you need to do something and what it is that you need to do. Not only updating your code base, also put in support requests for changes to requirements of packages or new releases.

Karthikavn’s picture

Status: Active » Fixed

#7, #37 - Fixed the issue.

cilefen’s picture

Nevertheless, #28 is the full solution.

mmjvb’s picture

Issue tags: -PHP 7.3

Removed PHP 7.3 because it has nothing to do with it.

Also, #7 and #37 DID NOT fix the issue. There are many ways to get to Drupal 8.7.0. Staying on drupal/drupal is NOT the right thing to do. Trying to convert from drupal/drupal to something that is meant for site building IS. Unfortunately, that is not provided yet, but they are working on it. Some people still don't understand it is a little bit more than moving drupal/core from replace to require. Even removing drupal/core composer.json from the merge plugin is not enough.

The proper fix is to go to a distribution meant for site building.

keithdoyle9’s picture

I removed the merge-plugin section and now I'm getting email validation errors. We're on 8.6.16. If I leave that in, I get dependency errors

@MakaziMtingwa

λ composer update --lock
Gathering patches for root package.
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
    - The requested package egulias/email-validator (locked at 2.1.7, required as ^1.2) is satisfiable by egulias/email-validator[2.1.7] but these conflict with your requirements or minimum-stability.
cilefen’s picture

It would be interesting to know how you executed composer after removing the merge plugin configuration and what the output was.

cilefen’s picture

...and post the composer.json because we are merely guessing at solutions without it.

kellyimagined’s picture

Using #59 with the following additional steps

Clear out vendor directory except simplesamlphp because simplesamlphp is just so dang finicky
Remove composer.lock
#59 steps
composer install
composer require drupal/core:^8.7.2

This worked.

karenann’s picture

After reading this entire thread, and the linked ones, I found my way to:
Update core PHP dependencies before 8.7.0

$ composer why-not drupal/core:8.7.3
drupal/drupal  dev-dev-8.x-3.2  requires  drupal/core (8.6.16)            
drupal/core    8.7.3            requires  egulias/email-validator (^2.0)  
drupal/drupal  dev-dev-8.x-3.2  requires  egulias/email-validator (^1.2) 

In my situation, I do NOT have egulias/email-validator in my composer.json so figured it was an underlying dependency. So, I didn't want to add it to my composer.json.

$ composer outdated -D
abraham/twitteroauth            0.7.4       1.0.1     The most popular PHP library for use with the Twitter OAuth REST API.
cweagans/composer-patches       1.6.5       1.6.6     Provides a way to patch Composer packages.
doctrine/annotations            v1.2.7      v1.6.1    Docblock Annotations Parser
doctrine/common                 v2.7.3      v2.10.0   Common Library for Doctrine projects
drupal/admin_toolbar            1.26.0      1.27.0    Provides a drop-down menu interface to the core Drupal Toolbar.
drupal/core                     8.6.16      8.7.3     Drupal is an open source content management platform powering millions of websites and applica...
drupal/entity                   1.0.0-rc2   1.0.0-rc3 Provides expanded entity APIs, which will be moved to Drupal core one day.
drupal/entity_browser           1.7.0       2.1.0     Entity browsing and selecting component.
drupal/entity_embed             1.0.0-beta3 1.0.0-rc1 Allows any entity to be embedded within a text area using a WYSIWYG editor.
drupal/google_analytics         2.4.0       3.0.0     Allows your site to be tracked by Google Analytics by adding a Javascript tracking code to eve...
drupal/restui                   1.16.0      1.17.0    Provides a user interface to manage REST resources
drupal/video_embed_field        1.5.0       2.1.0     A pluggable field type for storing videos from external video hosts such as Vimeo and YouTube.
egulias/email-validator         1.2.15      2.1.8     A library for validating emails
paragonie/random_compat         v2.0.18     v9.99.99  PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
symfony-cmf/routing             1.4.1       2.1.0     Extends the Symfony2 routing component for dynamic routes and chaining several routers
symfony/class-loader            v3.4.27     v3.4.28   Symfony ClassLoader Component
symfony/console                 v3.4.27     v4.3.1    Symfony Console Component
symfony/dependency-injection    v3.4.27     v4.3.1    Symfony DependencyInjection Component
symfony/event-dispatcher        v3.4.27     v4.3.1    Symfony EventDispatcher Component
symfony/http-foundation         v3.4.27     v4.3.1    Symfony HttpFoundation Component
symfony/http-kernel             v3.4.27     v4.3.1    Symfony HttpKernel Component
symfony/process                 v3.4.27     v4.3.1    Symfony Process Component
symfony/psr-http-message-bridge v1.1.2      v1.2.0    PSR HTTP message bridge
symfony/routing                 v3.4.27     v4.3.1    Symfony Routing Component
symfony/serializer              v3.4.27     v4.3.1    Symfony Serializer Component
symfony/translation             v3.4.27     v4.3.1    Symfony Translation Component
symfony/validator               v3.4.27     v4.3.1    Symfony Validator Component
symfony/yaml                    v3.4.27     v4.3.1    Symfony Yaml Component
twig/twig                       v1.40.1     v2.11.2   Twig, the flexible, fast, and secure template language for PHP
typo3/phar-stream-wrapper       v2.1.1      v3.1.2    Interceptors for PHP's native phar:// stream handling
zendframework/zend-diactoros    1.8.6       2.1.2     PSR HTTP Message implementations

I see egulias/email-validator in that list.

I haven't solved my implementation yet as it's time to go home, but wanted to share this here for anyone else who might find value in it.

cilefen’s picture

Read #28.

mmjvb’s picture

@karenann Migrate to a proper distribution for a clean solution or continue on the road of solving each issue at the time.
The combination of drupal/core as requirement and core/composer.json included by merge plugin is the cause.
That is why it is documented that drupal/drupal doesn't allow updating drupal/core.

Removing core/composer.json from the merge plugin will solve this issue for you. When not used for other things you can remove the merge plugin and the rest of its code in the extra key as well.

Assume you added scaffold. Not sure about remaining issues.

karenann’s picture

I had read #28. It is bookmarked. And thanks for the guidance, mmjvb and cilefen.

I'm working with inherited code and gathering info. I still need to get my house in order, as mentioned. However, there's a lot of info in this thread and I thought that https://www.drupal.org/project/drupal/issues/3032693 was informationally relevant, so I shared. YMMV.

terminalc’s picture

#37 was pretty close
I had to remove wikimedia/composer-merge-plugin configs in composer.json
I also had to

composer require symfony/http-foundation:~3.4.27 --no-update

Status: Fixed » Closed (fixed)

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

patrick.thurmond@gmail.com’s picture

I found that I just had to run `composer update` with no qualifying package names and it resolved this exact issue. This is because it looks for updates to all modules and packages and becomes more flexible.

mmjvb’s picture

Again, you haven't solved anything when staying on drupal/drupal. For site building you need to move away from drupal/drupal. It is meant for development of drupal itself, not for site management.

Advice against `composer update` without whitelisting packages. Yes, it will resolve your requirements if it can, but will update anything allowed. Unfortunately, that trusts the version constraints used. Currently a bad thing to do. There is a poor understanding of the version constraints and most don't provide the upper limit.

doncheks’s picture

Modifying the version of drupal or projects to run a composer update is definitely a temporary solution, as you would have to keep doing same for other minor updates.

When the composer update command below fails,
composer update drupal/core --with-dependencies

You may want to investigate your composer.json file. If you have "core/composer.json" in the merge plugin configuration, try removing it for a more permanent fix, as stated by @cilefen

To do that, Delete the following lines, if they exist

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

Also, delete these if they exist.

   "replace": {
        "drupal/core": "^8.x"
    },

Then run the composer update command as stated at the top of this post again.
It should work this time.
You may need to run composer update command twice if doesn't update to the latest version of drupal or download all dependencies.

The following has been tested for updating from 8.6.x to 8.7.x and from 8.7.x to 8.7.x

mmjvb’s picture

Advice against the above! Again, you haven't solved anything when staying on drupal/drupal. For site building you need to move away from drupal/drupal. It is meant for development of drupal itself, not for site management.

Suggest to wait for https://www.drupal.org/project/drupal/issues/3047468 or do the right thing instead.

EDIT: No longer suggest to wait for that. Unfortunately, the scope of that issue was changed and no longer useful. Leaves you with the manual work.

zyla’s picture

I've tried solution in #9 and it works for me. Thanks!

zyla’s picture

I've tried solution in #9 and it works for me. Thanks!

rakesh.gectcr’s picture

Looks like the #9 works!,

And my colleagues suggested me too, I ended up running like this
composer update drupal/core egulias/email-validator --with-dependencies

semiaddict’s picture

#9 worked for me as well.
As stated in https://github.com/webflo/drupal-core-require-dev, webflo/drupal-core-require-dev should have the same version constraint as the one used for drupal/core in composer.json

mmjvb’s picture

Indeed, #9 works. Do understand that it is the procedure that works, not the range of commands. Welcome to dependency management with Composer.

Procedure to update Drupal:
- Find out what is stopping you to update: composer prohibits
- Take away each blocking factor
-- Remove dev requirement of webflo when not needed: composer remove webflo/drupal-core... --no-update
-- Change version constraints of requirements: composer require ... --no-update
-- Find out what uses egulias/email-validator: composer depends egulias/email-validator
- Dry run the update: composer update drupal/core --with-dependencies --dry-run
- Whitelist allowable updates
- Run the update without --dry-run with --with-dependencies or whitelisted updates

There is no need to whitelist egulias/email-validator as it is a dependency of drupal/core. Suggest to remove webflo/drupal-core... or keep it in sync with drupal/core.

Obviously, your situation may be different, which is the reason you need to follow the procedure instead of the commands themselves. The commands themselves are just an example.

For those stubborn enough staying on drupal/drupal, good luck!

rhip’s picture

If you just need to update Drupal this might work:
composer require drupal/core egulias/email-validator
Perhaps not ideal but it might start you off.

lhguerra’s picture

I went around this by just requiring the conflicting libs and then removing them:

composer require drupal/core egulias/email-validator typo3/phar-stream-wrapper
composer remove egulias/email-validator typo3/phar-stream-wrapper

This way, composer can install the new Drupal version and then we can remove the libs we don't want in our composer.json
It is safe to remove these libs because they are already required by drupal/core

sistocarta’s picture

I took the core composer.json from de new Core version. Than the update works perfect.