Trying to install a module with a core dependency (drupal/image_url_formatter depends on drupal/image, drupal/address on drupal/field) fails if Drupal core doesn't contain the .git directory. Without the .git repository the composer-merge-plugin can't guess the version of drupal/core, causing dependency resolution to fail.
Classifying this as a major bug since it makes Composer unusable for anyone using Drupal from a tarball.
webflo has fixed this bug in https://github.com/wikimedia/composer-merge-plugin/pull/102, and the merge-plugin maintainers have tagged v1.3.1 for us.
We now need to update core to use it.
#1475510: Remove external dependencies from the core repo and let Composer manage the dependencies instead might happen in the meantime, but that still leaves us 8.0 to fix.
Steps to reproduce
- Create new drupal project using composer:
composer create-project drupal/drupal my-project 8.0.*@dev - Add drupal packagist:
"repositories": [ { "type": "composer", "url": "https://packagist.drupal-composer.org" } ] - Require Image url formatter module:
composer require drupal/image_url_formatter 8.1.*
Your requirements could not be resolved to an installable set of packages.
Problem 1
- drupal/image_url_formatter 8.1.x-dev requires drupal/image 8.* -> satisfiable by drupal/core[8.0.0, 8.0.0-beta12, 8.0.0-beta13, 8.0.0-beta14, 8.0.0-beta15, 8.0.0-beta16, 8.0.0-rc1, 8.0.0-rc2, 8.0.0-rc3, 8.0.0-rc4, 8.0.1, 8.0.x-dev].
- don't install drupal/core 8.0.x-dev|remove drupal/drupal No version set (parsed as 1.0.0)
- Installation request for drupal/drupal No version set (parsed as 1.0.0) -> satisfiable by drupal/drupal[No version set (parsed as 1.0.0)].
| Comment | File | Size | Author |
|---|---|---|---|
| #20 | 2638856-20-update-merge-plugin.patch | 9.04 KB | bojanz |
| #17 | 2638856-17.patch | 1.4 KB | webflo |
| #10 | 2638856-10-update-merge-plugin.patch | 9.03 KB | bojanz |
Comments
Comment #2
siliconmind commentedComment #3
bojanz commentedThis is a composer-merge-plugin bug that occurs only for people who installed Drupal via the tarball.
Composer tries to detect the version of the root package instead of the core package, leading to the fail.
(Composer detects versions properly when there's a git checkout, hence the tarball-only bug).
Comment #4
siliconmind commented@bojanz, in this case Drupal was installed via composer. Don't you think that it's a bit stupid, that drupal installed via composer is unmanageable through the same composer?
Comment #5
bojanz commented@SiliconMind
There are no smart bugs.
You probably answered Y to cleaning up the .git directories at the end of the Composer install/update. Hence the "can't detect version" problem.
Comment #6
siliconmind commented@bojanz
Of course I did. I needed to set up my own repo there.
Comment #7
peterpoe commentedI tried to manually add the version ("version": "8.0.5") but I get this weird error:
Package is not installed: drupal/drupal-8.0.5.0
If I add "version": "8.0.x-dev" the error gets even weirder:
Package is not installed: drupal/drupal-8.0.9999999.9999999-dev
Comment #8
bojanz commentedThis is the PR that needs to land into merge plugin: https://github.com/wikimedia/composer-merge-plugin/pull/102
After that we need to update merge plugin in core.
EDIT: PR landed, confirmed that the issue is gone. Waiting for merge-plugin 1.3.1 to be tagged.
Comment #9
bojanz commentedmerge-plugin v1.3.1 was tagged, time to update core.
Comment #10
bojanz commentedComment #11
webflo commentedConfirmed that is works with 8.[0|1].x and composer manager.
Comment #12
bojanz commented#1475510: Remove external dependencies from the core repo and let Composer manage the dependencies instead has landed for 8.1 and 8.2, let's fix 8.0.
Comment #13
webflo commentedWe should update the lockfile in 8.2.x and 8.1.x
Comment #14
bojanz commentedBah.
Comment #15
bojanz commentedLet's continue and fix this in 8.0.x
I am guessing 8.1 will want to update the versions in composer.lock before the next release anyone (and we can do it for all requirements at once).
Comment #16
catchSorry we should have an 8.2.x/8.1.x patch here as well as the 8.0.x one and fix all three branches at once. As far as I know there's no existing issue to update all requirements in 8.1.x so no guarantee it'll get done otherwise.
Comment #17
webflo commentedComment #18
bojanz commentedOkay, here we go. Thanks, webflo.
Comment #19
alexpottCommitted d974d55 and pushed to 8.1.x and 8.2.x. Thanks!
I tried to apply #10 to 8.0.x but it failed.
Comment #20
bojanz commentedHm, it applied for me, though with some pretty big offsets. Here's a reroll.
Comment #23
alexpottCommitted 71dbd0c and pushed to 8.0.x. Thanks!
Comment #26
xanoShouldn't this have updated composer.json as well to require
wikimedia/composer-merge-plugin:~1.3||>=1.3.1? The current solution still allows developers to accidentally specify 1.3.0, perhaps as a left-over from an existing Drupal 8 site, and by doing so to re-introduce the bug.Comment #27
sprite commentedJust observed this composer drupal bug while trying to update a Drupal 8 install:
---
Problem 1
- Installation request for drupal/drupal No version set (parsed as 1.0.0) -> satisfiable by drupal/drupal[No version set (parsed as 1.0.0)].
- drupal-composer/drupal-project 8.x-dev conflicts with drupal/drupal[No version set (parsed as 1.0.0)].
- Installation request for drupal-composer/drupal-project ~8.2 -> satisfiable by drupal-composer/drupal-project[8.x-dev].
---
Although there are posts about patches above, can somone please explain the root cause of the problem and provide a roadmap for fixing it in a buggy installation?
Comment #28
bojanz commented@sprite
Something is wrong in your composer.json, you appear to have both drupal/drupal and drupal-composer/drupal-project in there, they are competing project templates.
You should open a new support request and paste your composer.json there.
Comment #29
kamalpreet singh commentedFacing the Same Error.
I don't know What is the matter with Composer. I want to run Cart on the Drupal , So I Installed Commerce Module. For Installing Commerce Module, had to install other 3-4 required modules. ie Ctools 1.9, Views 3.13, Entity API 1.7, Rules 2.9, and Address field 1.2.
There are lots of Dependencies. Even If I don't want to use Composer, Is there any Alternate way ?
Lack of Documentation in Drupal.