Composer require failed in drupal10

Created on 26 January 2023, almost 2 years ago
Updated 2 February 2023, almost 2 years ago

Problem/Motivation

composer require 'drupal/redoc_field_formatter:^2.2' fails while trying to install the module on drupal 10 site with following error:

Your requirements could not be resolved to an installable set of packages.
 Problem 1
  - Root composer.json requires drupal/redoc_field_formatter ^2.2 -> satisfiable by drupal/redoc_field_formatter[2.2.0].
  - drupal/redoc_field_formatter 2.2.0 requires drupal/core 8.x || 9.x -> found drupal/core[8.0.0, ..., 8.9.20, 9.0.0, ..., 9.5.2] but the package is fixed to 10.0.0 (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.
 Problem 2
  - drupal/core 10.0.0 requires php >=8.1.0 -> your php version (7.3.29) does not satisfy that requirement.
  - drupal/core-recommended 10.0.0 requires drupal/core 10.0.0 -> satisfiable by drupal/core[10.0.0].
  - drupal/core-recommended is locked to version 10.0.0 and an update of this package was not requested.
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.

Noticed that the composer.json is missing in the project. Will adding of the composer.json with required dependencies for drupal core solve the issue.

Steps to reproduce

  1. Install a Drupal 10 website through composer.
  2. Execute composer require 'drupal/redoc_field_formatter:^2.2' from the root folder.
  3. Observe the composer depencies issue

Proposed resolution

Add a proper composer.json in the project.

Remaining tasks

  1. Create a composer.json for the project
  2. Test the composer require of the module on drupal 10 project.

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

2.2

Component

Code

Created by

🇮🇳India arisen Goa

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024