php composer error when attempting to add forum module to code

Created on 8 May 2023, about 1 year ago
Updated 10 May 2023, about 1 year ago

Problem/Motivation

$ ./composer require 'drupal/forum:^1.0'
Info from https://repo.packagist.org: #StandWithUkraine
./composer.json has been updated
Running composer update drupal/forum
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires drupal/forum ^1.0 -> satisfiable by drupal/forum[1.0.0].
    - drupal/forum 1.0.0 requires drupal/core ^8 -> found drupal/core[8.0.0, ..., 8.9.20] but the package is fixed to 10.0.9 (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.

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.

Steps to reproduce

Run the command on the module's home page

Proposed resolution

understand why the error is occuring, take steps to resolve. these not known at current time.

Remaining tasks

as above

User interface changes

none

API changes

none

Data model changes

none

💬 Support request
Status

Closed: works as designed

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom therobyouknow

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

Comments & Activities

  • Issue created by @therobyouknow
  • 🇬🇧United Kingdom therobyouknow

    Here are my setup details to help troubleshoot the issue:

    I'm running

    Drupal 10.0.9
    php 8.1.18
    Database Version 10.6.12-MariaDB-0ubuntu0.22.04.1

    My composer.json file is as follows:

    {
        "name": "drupal/recommended-project",
        "description": "Project template for Drupal projects with a relocated document root",
        "type": "project",
        "license": "GPL-2.0-or-later",
        "homepage": "https://www.drupal.org/project/drupal",
        "support": {
            "docs": "https://www.drupal.org/docs/user_guide/en/index.html",
            "chat": "https://www.drupal.org/node/314178"
        },
        "repositories": [
            {
                "type": "composer",
                "url": "https://packages.drupal.org/8"
            }
        ],
        "require": {
            "composer/installers": "^2.0",
            "drupal/core-composer-scaffold": "^10.0",
            "drupal/core-project-message": "^10.0",
            "drupal/core-recommended": "^10.0",
            "drupal/social_auth_facebook": "^4.0",
            "drush/drush": "^11.5"
        },
        "conflict": {
            "drupal/drupal": "*"
        },
        "minimum-stability": "stable",
        "prefer-stable": true,
        "config": {
            "allow-plugins": {
                "composer/installers": true,
                "drupal/core-composer-scaffold": true,
                "drupal/core-project-message": true,
                "phpstan/extension-installer": true,
                "dealerdirect/phpcodesniffer-composer-installer": true
            },
            "sort-packages": true
        },
        "extra": {
            "drupal-scaffold": {
                "locations": {
                    "web-root": "web/"
                }
            },
            "installer-paths": {
                "web/core": [
                    "type:drupal-core"
                ],
                "web/libraries/{$name}": [
                    "type:drupal-library"
                ],
                "web/modules/contrib/{$name}": [
                    "type:drupal-module"
                ],
                "web/profiles/contrib/{$name}": [
                    "type:drupal-profile"
                ],
                "web/themes/contrib/{$name}": [
                    "type:drupal-theme"
                ],
                "drush/Commands/contrib/{$name}": [
                    "type:drupal-drush"
                ],
                "web/modules/custom/{$name}": [
                    "type:drupal-custom-module"
                ],
                "web/profiles/custom/{$name}": [
                    "type:drupal-custom-profile"
                ],
                "web/themes/custom/{$name}": [
                    "type:drupal-custom-theme"
                ]
            },
            "drupal-core-project-message": {
                "include-keys": [
                    "homepage",
                    "support"
                ],
                "post-create-project-cmd-message": [
                    "<bg=blue;fg=white>                                                         </>",
                    "<bg=blue;fg=white>  Congratulations, you’ve installed the Drupal codebase  </>",
                    "<bg=blue;fg=white>  from the drupal/recommended-project template!          </>",
                    "<bg=blue;fg=white>                                                         </>",
                    "",
                    "<bg=yellow;fg=black>Next steps</>:",
                    "  * Install the site: https://www.drupal.org/docs/installing-drupal",
                    "  * Read the user guide: https://www.drupal.org/docs/user_guide/en/index.html",
                    "  * Get support: https://www.drupal.org/support",
                    "  * Get involved with the Drupal community:",
                    "      https://www.drupal.org/getting-involved",
                    "  * Remove the plugin that prints this message:",
                    "      composer remove drupal/core-project-message"
                ]
            }
        }
    }
  • 🇩🇰Denmark ressa Copenhagen

    If I relax the stability to "minimum-stability": "dev", I can install it.

    Interestingly, I don't see a composer.json in https://git.drupalcode.org/project/forum ...

  • 🇬🇧United Kingdom therobyouknow

    If I relax the stability to "minimum-stability": "dev", I can install it.

    Champion @ressa - yes that worked, thankyou:

    $ ./composer require 'drupal/forum:^1.0'
    Info from https://repo.packagist.org: #StandWithUkraine
    ./composer.json has been updated
    Running composer update drupal/forum
    Loading composer repositories with package information
    Updating dependencies
    Lock file operations: 1 install, 0 updates, 0 removals
      - Locking drupal/forum (dev-1.x 4978fff)
    Writing lock file
    Installing dependencies from lock file (including require-dev)
    Package operations: 1 install, 0 updates, 0 removals
      - Syncing drupal/forum (dev-1.x 4978fff) into cache
      - Installing drupal/forum (dev-1.x 4978fff): Cloning 4978fff629 from cache
    Generating autoload files
    42 packages you are using are looking for funding.
    Use the `composer fund` command to find out more!
    No security vulnerability advisories found
    $
  • 🇬🇧United Kingdom therobyouknow

    Not sure why it needs to be "dev" though, given that the release doesn't have that mentioned in the name, nor alpha, nor beta, it's just: "1.0.0", so I'd say stable ought to work.

  • 🇮🇳India arisen Goa

    The maintainers have not released Drupal 10 compatible version of the module.

    When we add "minimum-stability": "dev" in composer the dev release of the module gets installed which is compatible with Drupal 10. The Maintainers need to create a new release supporting Drupal 10 using latest code from dev branch incase there are no more changes required for Drupal 10.

  • Status changed to Closed: works as designed about 1 year ago
  • 🇬🇧United Kingdom therobyouknow

    thanks @arisen - closed as worked as designed.

  • 🇩🇰Denmark ressa Copenhagen

    @therobyouknow: Great you got it downloaded! Like I noted before, there is no composer.json file, which could explain some of the odd behavior ... I created the issue 📌 Add a composer.json file Needs review .

    @arisen: The module is installable on all releases after Drupal 9.4, from forum.info.yml:

    core_version_requirement: '>=9.4'

    I don't know if it works, though.

  • 🇩🇰Denmark ressa Copenhagen

    Oops, updated the title by mistake. Reverting.

  • 🇮🇳India arisen Goa

    @ressa No the stable version of forum module is not installable on Drupal 9 if the composer file has "minimum-stability": "stable".

    The stable release(1.0.0) of the module doesn't have core_version_requirement set to 9.4. You can check the info file of the stable releasehere.

    The maintainers need to create a new release to support Drupal 10. Before Drupal 10 forum module was part of the core but won't be in Drupal 10 hence this module.

    Also as per my opinion, we shouldn't be creating the composer.json file just to specify the Drupal version. More details here https://www.drupal.org/docs/develop/creating-modules/add-a-composerjson-...

  • 🇩🇰Denmark ressa Copenhagen

    @arisen: You're right, I was looking in the dev-version, which has the core_version_requirement: '>=9.4' line and can be installed in Drupal 10. I agree that it would be great if a stable release was tagged by the maintainers.

  • 🇦🇺Australia larowlan 🇦🇺🏝.au GMT+10

    Before Drupal 10 forum module was part of the core but won't be in Drupal 10 hence this module.

    FWIW this is not true. We _wanted_ to remove it from core but we ran out of time.

    It is still part of Drupal core and you do not need this module yet

  • 🇮🇳India arisen Goa

    Thanks for the clarification @larowlan :)
    I had read about the plan to remove it, but did not verify its presence in Drupal 10 core.

Production build 0.69.0 2024