I have installed Drupal using Composer and drupal-composer/drupal-project. If I try to add Commerce afterwards using

composer require "drupal/commerce

I get

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

  Problem 1
    - Installation request for drupal/entity (locked at 1.0.0-alpha4) -> satisfiable by drupal/entity[1.0.0-alpha4].
    - drupal/commerce 2.0.0-beta5 requires drupal/entity 1.x-dev -> satisfiable by drupal/entity[1.x-dev].
[...]

Is really the dev version of Entity still required?

Comments

hansfn created an issue. See original summary.

agoradesign’s picture

Hi,

Drupal 8.2.5 itself does not require drupal/entity, neither does the drupal-composer/drupal-project Composer template afaik. So you've must have required drupal/entity yourself explicitely. Is that correct?

Further, as a rule of thumb, you should only add drupal/entity to your project's composer.json, if you really depend on that yourself. If you just added it because Commerce or any other module depends on it, do not add it explictly, Composer will find out and download all required dependencies itself.

If you still need the drupal/entity entry in your composer.json file, and you absolutely don't want to use the dev version, you can still trick Composer by adding this line to your composer.json instead:

"drupal/entity": "1.0.0-alpha4 as 1.x-dev"

hansfn’s picture

Title: Composer install requires drupal/entity 1.x-dev while Drupal 8.2.5 has 1.0.0-alpha4 » Composer install requires drupal/entity 1.x-dev instead of 1.0.0-alpha4

Ok, I'm an idiot :-)

Of course Drupal core doesn't require the Entity module. I'll have to investigate where the requirement comes from.

Anyway, my question stands: Does Commerce 2.x at beta5 really require a dev version of Entity?

bojanz’s picture

We simply haven't updated the requirement yet. Entity API is in alpha so it's pretty much the same thing stability-wise.

hansfn’s picture

Version: 8.x-2.x-dev » 8.x-2.0-beta5

I don't disagree that stability wise an alpha and dev version is similar.

Anyway, I have investigated and I have found the problem. I did not require Entity directly - there is no drupal/entity line in my composer.json. It's coming from Media Entity which requires "entity:entity (>=8.x-1.0-alpha3)" in the info file (which generates the dependencies for Composer). I think this requirement causes the problem, and I think this problem is worth fixing.

bojanz’s picture

Okay, let's patch our composer.json and fix it.

hansfn’s picture

Should I create a patch or will you just fix it?

ndf’s picture

Status: Active » Needs review
StatusFileSize
new428 bytes

Mini-patch attached.
drupal/entity:~1.0 resolves to 1.0.0-alpha4

pianomansam’s picture

@ndf you patch applies to 8.x-2.x-dev but not 8.x-2.0-beta5 because drupal/address went from ~1.0 to 1.x-dev

bojanz’s picture

Title: Composer install requires drupal/entity 1.x-dev instead of 1.0.0-alpha4 » Require stable versions of Entity API and Address

Tagged a new Address RC4, so we can fix that requirement at the same time.

  • bojanz committed 1a66ca8 on 8.x-2.x authored by ndf
    Issue #2845362 by ndf: Require stable versions of Entity API and Address
    
bojanz’s picture

Status: Needs review » Fixed

Done.

Status: Fixed » Closed (fixed)

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