1

Edit: Gist of my complete composer.json

I'm seeing some confusing behaviour with Drupal branch names when adding modules using composer - specifically I seem to be getting the 7.x version of the module rather than 8.x.

This is a composer based setup, running 8.3.0-rc1 - composer.json includes:

"drupal/core": "8.3.0-rc1"

My understanding has always been that for modules, whenever you specify the branch in composer, you remove the 7.x- or 8.x from the start.

e.g. I wanted the tagclouds module 8.x-1.x branch, so I did:

composer require drupal/tagclouds:1.x 

Yet what it actually installs is 7.x-1.9+30-dev

Composer output:

 - Installing drupal/tagclouds (dev-1.x 54086ae) Cloning 54086ae717

I also ran drush ups and got:

Project was not packaged by drupal.org but obtained from git. You need to enable git_deploy module

So I add and enable git_deploy the same way.

composer.json:

"drupal/git_deploy": "2.x"

again it installs a 7.x release (7.x-2.2+10-dev)

Any obvious mistakes?

Other things I've tried:

  • Explicility listing the stability in the version constraints, e.g. 2.x-dev instead of 2.x, and 1.x-dev not `1.x'. (The documentation suggests composer adds this by default though.)
  • Using composer update nothing to regenerate the composer.lock file
4
  • 1
    Are you using the correct packages repo in your repository key?
    – Kevin
    Mar 3, 2017 at 13:45
  • Could you post your full composer.json file as well to the question?
    – Kevin
    Mar 3, 2017 at 14:27
  • @Kevin: Here's the full composer.json Mar 3, 2017 at 14:38
  • Wow, this composer.json is taking over 20 minutes to build and hasn't finished yet.
    – mradcliffe
    Mar 3, 2017 at 20:50

1 Answer 1

1

Make sure you are using the correct repository endpoint for Composer. For Drupal 8, it is https://packages.drupal.org/8.

Your composer.json file should contain a repository key like so:

{ 
    "repositories": { 
        "drupal": {
            "type": "composer",
            "url": "https://packages.drupal.org/8" 
        }
    }
}
3
  • Yep, already got that. Mar 3, 2017 at 14:34
  • Actually mine doesn't have a "drupal" key - will add that and check again... Mar 3, 2017 at 14:39
  • … didn't make any difference, and in any case, when I checked git remote -v from within a couple of modules, they had the correct git.drupal.org/project repository paths Mar 3, 2017 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.