0

I recently made a core update with drush for D8. After the update I saw that it removed a folder from the 'vendor' folder on the server? Why did that happen?

The module has been installed via Composer because it needs dependencies to be installed: https://www.drupal.org/project/alinks

Re-installing the dependencies, works:

composer require "wamania/php-stemmer"

Is there something I did wrong? Do I need to update the core in a different way rather then using drush if you have installed modules via composer?

Removing the module via backoffice D8 and then removing folders from 'module/contrib' and 'vendor' and then re-installing the module works, but that is just not the way to do.

Thanks.

  • You should not mix up Composer installs and Drush installs. I could imagine that the Drush update fetched the entire Drupal core including it's composer.json, which does not include your module. So it will be uninstalled. Better upgrade your core using Composer. – Mario Steinitz Feb 23 '18 at 10:36
  • I understand, while the site now is mixed up with drush and composer, can I just update the core from now with composer? Will that work? In general, if you have ever updated modules with drush, can you switch to composer or not? – user3086053 Feb 23 '18 at 12:29
  • You can always switch to Composer. But it's a sissyphus work to getting started. You should take the composer.json of any working Composer scaffold as starting point. (Not the Drupal core composer.json.) Then you should add the core and all your modules in the version your site is running already. After you made sure everything is working with your current DB, you can change the module versions to automatically update to higher versions if available. I always keep the core at a distinct version and update only when required (as yesterday after 8.4.5 was released). – Mario Steinitz Feb 23 '18 at 12:39
  • ...which can then be done by e.g. a composer require drupal/core:8.4.5. – Mario Steinitz Feb 23 '18 at 12:41
  • Well I'm a bit lost here on how to manage this, so more info is required I guess? Today I tried to install a module with composer (fieldblock) but could not find it? So I had to install it with drush ... For me it is not really clear right now what the best practice is and how to avoid problems in the future when having a core update ... – user3086053 Feb 23 '18 at 15:24
3

This is normal, because an update with Drush overwrites vendor and composer.json. So if you've installed a module via composer you need to reinstall it the same way (but you should be able to avoid a reinstall in the backoffice if you manage to get the code base right before running update.php or drush updatedb).

Updating core with Drush is depracetated and this function is removed from Drush 9.0. So you might consider switching core to a composer based install.

Edit to answer this comment:

Well I'm a bit lost here on how to manage this, so more info is required I guess? Today I tried to install a module with composer (fieldblock) but could not find it? So I had to install it with drush ... For me it is not really clear right now what the best practice is and how to avoid problems in the future when having a core update ..

It's still OK to manage core and module updates with Drush as long as you use only modules which can be installed by Drush and don't mix it with Composer. However, when you start to use composer only modules you should really think about switching over to a composer based Drupal install. It's possible to start a new composer based project and keep the existing database, see this great answer from @greg_1_anderson Updating core with Composer doesn't work

  • All clear. I understand to not mixing up both. Thanks! – user3086053 Feb 25 '18 at 10:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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