10

I installed a Drupal 8.2.0 site with composer create-project drupal/drupal testsite.

Now I would like to upgrade it to Drupal 8.2.1. However, running composer update drupal/drupal doesn't work. It prints the following error:

Package "drupal/drupal" listed for update is not installed. Ignoring.

How do I do this? The support is clearly documented in example.gitignore.

# Ignore core when managing all of a project's dependencies with Composer
# including Drupal core.
# core

So there has to be some way to do this with composer, but how?

4 Answers 4

5

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
1
  • 2
    Interesting error message from that second command: "There are no commands defined in the "https" namespace." I'm really lost now.
    – Mojo
    Mar 6, 2018 at 19:27
4

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.

1
  • 2
    The command composer create-project uses the requested project as a template for the new project, so in your first attempt, git.drupal.org/project/drupal.git was used as a template for your new project. Using github.com/drupal-composer/drupal-project as the template instead, causes Drupal to be one part of the project. In fact, instead of using drupal/drupal, it uses drupal/core (for the core directory) and drupal-composer/drupal-scaffold for the other important files like index.php and .htaccess. Oct 16, 2016 at 17:25
3

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.

3

On the command line, we had to require drupal core (replace with your version):

composer require drupal/core:8.6.3 --update-with-dependencies

In the composer.json file under replace we had to remove "drupal/core": "^8.6" so replace looks like:

"replace": {

},

in our composer.json file now. We then ran:

composer update

and drupal updated to the latest version.

Your Answer

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

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