Incorrect branch when adding modules with composer 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
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" 
        }
    }
}