Drupal - Why doesn't "composer update drupal/drupal" work?
Edit: this is probably not helpful b/c I just re-read your statement and you didn't have the same case as mine where I was coming from an old Drupal 8 install but I will leave this up in case anyone else has this issue and try to see if I can find the specific issue you are having. Sorry.
I had this issue when dealing with a recent update and this was my issue but YMMV so if it doesn't work just let me know.
This may be a problem of that you composer file is set to the old repository listing on composer.org. Recently, Drupal setup their own composer endpoints, one for Drupal 7 and another for Drupal 8. You can read more about that change here: https://www.drupal.org/docs/develop/using-composer/using-composer-to-install-drupal-packages-through-drupalorg
This is the command that needs to be ran to swap the repository over the Drupal.org's.
$ composer config repositories.0
$ composer https://packages.drupal.org/8
Think I solved it. I figured that I would need a different root composer.json file that pulled in the drupal package instead of replacing it, but I didn't know how to do so.
Fortunately, someone has already done this and repackaged Drupal in a composer-friendly way: https://github.com/drupal-composer/drupal-project (No stable version yet, apparently.)
By using composer create-project drupal-composer/drupal-project:8.x-dev --stability dev drupal-dir
I was able to get an install that can be updated with composer.
The command composer create-project
clones the requested package, which in this case is https://git.drupal.org/project/drupal.git. At the end of the project creation process, you should be prompted whether you want to remove the existing VCS history. If you answered n
, you will have a way to update from the upstream drupal repository. Navigate into testsite, and use git to fetch and check out the version of Drupal you want. Then run composer install
to get the dependencies identified in composer.json and composer.lock of the updated version of Drupal.