Conflict with chose_lib

Created on 29 January 2025, 2 months ago

Problem/Motivation

When attempting to update from Chosen 4.0.3 to 5.0 using Composer, I am seeing this...

Problem 1
    - Root composer.json requires drupal/chosen ^5.0, found drupal/chosen[dev-5.0.x, 5.0.0-alpha1, 5.0.0-rc1, 5.0.0, 5.0.x-dev] but these were not loaded, likely because it conflicts with another require.

Issuing a...

$ composer why-not drupal/chosen 5.0

Reveals...

drupal/recommended-project dev-main requires drupal/chosen (^4.0)
drupal/chosen_lib          4.0.3    requires drupal/chosen (^4)

Do I even need chosen_lib any more?

Thaaks anyone for a tip here.

💬 Support request
Status

Active

Version

5.0

Component

Code

Created by

🇬🇧United Kingdom SirClickALot Somerset

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

Comments & Activities

  • Issue created by @SirClickALot
  • 🇭🇺Hungary nagy.balint

    Hi!

    run
    composer require drupal/chosen:5.0.0 drupal/chosen_lib:5.0.0 -W

    But also make sure that you have the related library, as 5.0.0 uses a fork of chosen without jQuery.

  • 🇬🇧United Kingdom SirClickALot Somerset

    Hi nagy.balint,

    Thanks for your guidance here but can you please be more specific about precisely which version I should be using?

    In the past (for some reason?) I have been manually downloading and adding the Chosen JS library but once I am clear about the precise version, is it OK for me to add it into my sites' composer.json using similar lines these I use for some other libraries...

    "npm-asset/lazysizes": "^5.3",
    "npm-asset/select2": "^4.0",
    "npm-asset/superfish": "^1.7",
    

    Thanks a lot.

  • 🇭🇺Hungary nagy.balint

    I usually add the library into the repositories section of the composer.json

            {
                "type": "package",
                "package": {
                    "name": "noli42/chosen",
                    "version": "3.0.0",
                    "type": "drupal-library",
                    "dist": {
                        "url": "https://github.com/noli42/chosen/releases/download/3.0.0/chosen-assets-v3.0.0.zip",
                        "type": "zip"
                    }
                }
            },
    

    and then i can just do composer require noli42/chosen

  • 🇬🇧United Kingdom SirClickALot Somerset

    Thanks again!

    For consistency in my composer.json, am I able to use an npm-asset-style line as above in my question.

    Notwithstanding any individual's work, I would rather use a reference to the node asset library if possible and if so, might it simply be...

    "npm-asset/chosen": "^3.0" ?

  • 🇭🇺Hungary nagy.balint

    For that the library would need to be published under npm-asset which is not the case currently.

  • 🇬🇧United Kingdom SirClickALot Somerset

    Could it be, should it be?

  • 🇭🇺Hungary nagy.balint

    npm-asset/chosen is already taken.

    I could try registering at https://packagist.org/ so then it would be possible to install the lib without the repositories section as composer require noli42/chosen.

    And then it will only need one line at
    "installer-paths": {
    "docroot/libraries/{$name}": [

    something like
    "vendor:noli42",

    to make sure that it is installed at the right place.

Production build 0.71.5 2024