Score:0

Composer require installation profile constraint match error

us flag

I am trying to download this install profile https://github.com/UH-StudentServices/student_guide

I added it to composer.json like this

"repositories": [
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        {
            "type": "vcs",
            "url": "[email protected]:UH-StudentServices/student_guide.git"
        }
    ],

Then I did composer require and I got following error

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires uh-studentservices/student_guide ^1.62 -> satisfiable by uh-studentservices/student_guide[v1.62].
    - uh-studentservices/student_guide v1.62 requires drupal/block_access dev-8.x-1.x#1cd59ba6856c897afae2551feaa8e6b7f312489c -> found drupal/block_access[dev-1.x, 1.0.0-alpha1, 1.0.0-beta1, 1.x-dev (alias of dev-1.x)] but it does not match the constraint.

I know that the module version should be dev-1.x and not dev-8.x-1.x. I am wondering what should I do. May be I can clone the install profile and edit the composer.json, but How can I include it in composer.json locally?

Score:1
id flag

It is necessary to add to the repositories key in composer.json all of the repositories specified by the project because it seems some are not registered with Packagist.

"repositories": [
        {
            "type": "composer",
            "url": "https://asset-packagist.org/"
        },
        {
            "type": "vcs",
            "url": "https://github.com/larowlan/block_access"
        },
        {
            "type": "composer",
            "url": "https://packages.drupal.org/8"
        },
        {
            "type": "package",
            "package": {
                "name": "rubaxa/sortable",
                "version": "v1.4.0",
                "type": "drupal-library",
                "dist": {
                    "url": "https://github.com/RubaXa/Sortable/archive/1.4.0.zip",
                    "type": "zip"
                }
            }
        },
        {
            "type": "vcs",
            "url": "https://github.com/UH-StudentServices/video_embed_unitube"
        },
        {
            "type": "vcs",
            "url": "https://github.com/UH-StudentServices/uh_courses_embed"
        },
        {
            "type": "vcs",
            "url": "[email protected]:UH-StudentServices/student_guide.git"
        }
    ],

Notice that although the profile will install, you will see:

 Cannot apply patch 2795115-6-and-2860399-1 (patches/google_analytics_reports.patch)!

That is because there is a patches directory in the parent project that you will not have. I think that if you copy the patches to your own project, the patch may apply.

us flag
Now I am getting following error `Your requirements could not be resolved to an installable set of packages. Problem 1 - Root composer.json requires uh-studentservices/student_guide ^1.62 -> satisfiable by uh-studentservices/student_guide[v1.62]. - uh-studentservices/student_guide v1.62 requires rubaxa/sortable 1.4.0 -> could not be found in any version, there may be a typo in the package name.`
us flag
This is what I did `"repositories": [ { "type": "vcs", "url": "[email protected]:UH-StudentServices/student_guide.git" }, { "type": "vcs", "url": "https://github.com/larowlan/block_access" }, { "type": "composer", "url": "https://packages.drupal.org/8" } ],`
id flag
If you are specifying repositories, and still need to use the official one, Packagist, then you also require this one: { "type": "composer", "url": "https://asset-packagist.org" } It is there by default in the official Drupal starter project.
us flag
Thanks, but still the same error
id flag
I suppose the only way forward is for you to post a composer.json that reproduces this.
us flag
Here is my composer.json https://www.dropbox.com/s/1mabkyc507qia80/composer.json?dl=0
id flag
That ^ composer.json file works for me. There must be something missing from the steps to reproduce above. What are the arguments to `composer require` that fail?
id flag
Oh, I see: `composer require uh-studentservices/student_guide` fails. You require *all* the repositories specified by the composer.json in uh-studentservices/student_guide, not only some. I will update the answer.
us flag
Under patches folder, there is a sql folder. What is it about?
us flag
The `composer require` command worked thanks a lot. However, at the end I see this `Not scaffolding files for uh-studentservices/student_guide, because it is not listed in the element 'extra.drupal-scaffold.allowed-packages' in the root-level composer.json file.`
id flag
I've answered the question. Please accept my answer. Configuring drupal-scaffold, which is well-documented (https://github.com/drupal/core-composer-scaffold), is a different question.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.