Problem/Motivation

When trying to install the module through composer in a Drupal 9.3.7 environment, the following error occurs:

  Problem 1
    - drupal/civicrm_group_roles dev-1.0.x requires drupal/core ~8.0 -> found drupal/core[8.0.0-beta6, ..., 8.9.x-dev] but the package is fixed to 9.3.7 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - drupal/civicrm_group_roles 1.0.x-dev is an alias of drupal/civicrm_group_roles dev-1.0.x and thus requires it to be installed too.
    - Root composer.json requires drupal/civicrm_group_roles ^1.0 -> satisfiable by drupal/civicrm_group_roles[1.0.x-dev (alias of dev-1.0.x)].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

I believe this is because the module does not have a composer.json file. I've seen this issue before with other modules and adding the composer.json file generally resolves the issue.

Steps to reproduce

  1. Create a Drupal 9.3.7 project using composer (drupal/core-recommended:~9.3.0)
  2. Run composer require drupal/civicrm_group_roles

Proposed resolution

Add a composer.json file.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

NickDJM created an issue. See original summary.

nickdjm’s picture

Status: Active » Needs review

I submitted a MR with the composer.json file added and it does indeed resolve the issue.

For anyone wanting to test this you can add an entry to the repositories section in your composer file (above the packages.drupal entry):

"drupal/civicrm_group_roles": {
    "type": "git",
    "url": "https://git.drupalcode.org/issue/civicrm_group_roles-3268176.git",
    "no-api": true
}

And then run composer require drupal/civicrm_group_roles:dev-3268176-module-not-compatible.

Edit: fixed the url for the repository

proteo’s picture

I had the same issue, because I thought the command posted in the module page was wrong:

$ composer require 'drupal/civicrm_group_roles-civicrm_group_roles:^1.0'

So I changed civicrm_group_roles-civicrm_group_roles to civicrm_group_roles and got the error. But to my surprise, running the suggested command works just fine.

nubeli’s picture

Status: Needs review » Reviewed & tested by the community

@NickDJM not sure how best to test it. I tried the composer require line you posted but got the error: "Root composer.json requires drupal/civicrm_group_roles dev-3268176-module-not-compatible, found drupal/civicrm_group_roles[dev-1.0.x, 1.0.x-dev (alias of dev-1.0.x)] but it does not match the constraint."

Thought this might work: lando composer require drupal/civicrm_group_roles-3268176:dev-3268176-module-not-compatible but also no.

At any rate the composer.json file looks fine. Need it to ensure the module can be installed properly.

  • matt-trim committed 891301d on 1.0.x authored by NickDJM
    Issue #3268176: Module not compatible with D9 when installing through...
matt-trim’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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