Composer 2 puts harvesthq/chosen in wrong folder

Created on 19 December 2019, about 5 years ago
Updated 30 October 2023, about 1 year ago

Before the 2.9 update I was requiring harvesthq/chosen in my project's composer.json file and specifying that its package type is drupal-library to add it to the libraries folder.

After updating drupal/chosen to 8.x-2.9 where the package is added as a dependency, composer now installs it in the vendor folder instead. I believe the composer.json file needs to provide the repository information and give it the drupal-library type (instead of the default library) for it to be in the correct folder.

🌱 Plan
Status

Needs work

Version

4.0

Component

Code

Created by

🇺🇸United States cantrellnm

Live updates comments and jobs are added and updated live.
  • Needs issue summary update

    Issue summaries save everyone time if they are kept up-to-date. See Update issue summary task instructions.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇳India siddharthjain

    I came late to this issue queue, but after going through all the comments #47 worked for me. If you are following comment #17 then you must have "oomphinc/composer-installers-extender": "^1.0" version other you will get the same error(as per #27).

  • 🇬🇧United Kingdom jacobupal Leeds

    Just to lay it out, to install drual/chosen (and therefore install jjj/chosen to the correct place) with composer you need to do the following:

    1. composer require wikimedia/composer-merge-plugin
    2. add the following to the "extra" section of your composer.json:
      "merge-plugin": {
        "include": [
          "web/modules/contrib/chosen/composer.libraries.json"
          ]
      },
    3. composer require 'drupal/chosen:^4.0' -W
  • 🇺🇸United States codesmith San Francisco

    As per #3069730 to not use wikimedia/composer-merge-plugin I was able to get drupal/chosen and jjj/chosent to install correctly by:

    1) Manually add to "repositories" section

        "repositories": [
            {
                "type": "package",
                "package": {
                    "name": "jjj/chosen",
                    "version": "2.2.1",
                    "type": "drupal-library",
                    "extra": {
                        "installer-name": "chosen"
                    },
                    "source": {
                        "url": "https://github.com/JJJ/chosen.git",
                        "type": "git",
                        "reference": "2.2.1"
                    }
                }
            }
    

    2) Then from your project's root directory

    composer require 'drupal/chosen:^4.0'
    composer require 'jjj/chosen:^2.2'
    
Production build 0.71.5 2024