20

For example if you perform the following commands:

drush dl views
drush en views views_ui views_export

You will get the the following error when trying to enable the views modules:

Module views cannot be enabled because it depends on the following modules which could not be found: ctools

Is there a way to get drush to download required module dependancies?

  • Really Drupal should just integrate composer. Dependency management would be nicely handled then. – David Sep 10 '13 at 8:55
  • Newer versions of Drush with drush en -y will automatically download and enable dependencies. – tyler.frankenstein Apr 27 '15 at 4:36
18

Drush 5 and up:

Newer versions of Drush (version 5 and higher) will ask you if you want to download the required dependencies when you enable (drush en) a module. It will also ask if you want to download the module itself if you didn't download it yet. Combined with the "-y" option (e.g. drush en views -y), everything will be downloaded and enabled automatically without asking further questions.

Note that the automatic downloading of dependencies may fail if the required module's name is not the same as its project name on drupal.org. For more info, see the my original answer for Drush 4 below.

Original answer (Drush 4):

No, there is no way to do that. The problem is that there is a difference between a module and a project. Often (but not always) the name of the project is identical to the module (or one of the modules) contained in the project. A single project (eg. Views) can contain multiple modules (views, views_ui, views_export). While drush dl downloads a project, drush en enables a module.

When a module declares dependencies, it declares dependencies on modules, not projects. When performing a drush en, Drush can check if the required module is available. However if it's not available, Drush has no way of knowing which project to download. For Drush to be able to automatically download required projects, work needs to be done in the underlying projects/modules infrastructure, so Drush can retrieve a mapping of projects and modules. See also Smarter handling of missing dependencies.

9

Actually, drush5 (still in development) has a map of known, common dependencies (content.module, ctools, ...). So it does indeed download ctools for you in your example.

6

this is not anymore a problem since latest versions of drush does this "automagically":

The following projects have unmet dependencies:[ok]
answers requires strongarm, references, nodereference_url, nodereference_count, eva
Would you like to download them? (y/n):
2

Some modules, or projects include a drush make script, which can download dependencies and install external libraries.

However This is mostly not the case, and there are issues with nesting of drush make scripts. It is still worth looking out for with some of the modules which are more complicated to set up.

  • 1
    I think you mean 'Drush make' (drupal.org/project/drush_make) not 'Drush build'. But you're right, because a drush make file lists the projects that are required for the build, it is able to download dependencies. – marcvangend Mar 15 '11 at 14:20
2

Try the Quick update module. It will download all missing dependency projects for you.

Here is a quote about it (from the module's project page):

... provides a quick way to batch install multiple new projects or all the missing dependency projects.

Drupal core provides a way to install module or theme one by one, but you can install multiple projects via the Quick update module. There is an admin UI to search the most installed projects easier.

Additional, Quick update module finds all missing dependency projects for you, then you can just select all of them from the admin UI and install them in a batch process.

The Quick update module depends on the Update module and uses the same workflow as the Update module. Thus, you can run the updates via the admin update page at /admin/reports/updates/update.

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.