1

I'm trying to run a composer update from my webroot directory. When I use composer update drupal/core --with-dependencies, it returns:

Package "drupal/core" listed for update is not installed. Ignoring.
Loading composer repositories with package information
Updating dependencies (including require-dev)

I wasn't sure if I needed to require the drupal/core package with composer? I tried that, but it had no effect. Following the advice of online forums, I adjusted the following settings in the composer.json file:

"require": {
    "composer/installers": "^1.0.24",
    "wikimedia/composer-merge-plugin": "~1.4",
    "drupal/drush": "^6.0@RC",
    "drush/drush": "~9.0"
},
"replace": {
    "drupal/core": "~8.4"
},
"minimum-stability": "dev",
"prefer-stable": true,
"config": {
    "preferred-install": "dist",
    "autoloader-suffix": "Drupal8"
},

I changed the drush version to ~9.0 and the core version to ~8.4. I then deleted the /vendor directory and the composer.lock file. After running the update again, it updated a few other packages, but ignored core. I feel like I'm missing something simple. Any help is appreciated!

1 Answer 1

5

If you downloaded Drupal from drupal.org (e.g. via the tarball download link, or with drush dl), then you cannot use Composer to update Drupal core. The steps you are attempting above only work for sites based on the template project https://github.com/drupal-composer/drupal-project. This is the recommended method to use when managing Drupal 8 sites with Composer.

2
  • 2
    And as a footnote to this, it is possible to work a tarball install into a drupal-project install, if you are comfortable enough with composer and git (assuming you have site in git). I would do this before 8.3->8.4, though, and also use webflo/drupal-core-strict pinning both it and core to the exact Drupal version while you work on the conversion.
    – mpdonadio
    Nov 2, 2017 at 0:28
  • This was immensely helpful! I'm so used to everything being contained inside the webroot. The Composer directory structure is odd to me. Is there documentation on setting up git, using this method? Typically, the webroot would be the git repo, but I assume I'll need all of the composer stuff on the server, so should I set the git repo a level above the web directory?
    – Kellen
    Nov 2, 2017 at 12:58

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.