1

On my newly installed Drupal 8.4.4 sandbox installation, I've installed Drush 9 and the Devel module:

composer require drush/drush:^9
composer require drupal/devel

After running these commands, I installed the Devel module using the Extend tab in Drupal.

Drush seems be be installed correctly:

www-data@39e134dc7690:~/html$ /var/www/html/vendor/bin/drush version
Drush version : 9.1.0

The Devel modules seems to be installed correctly:

www-data@39e134dc7690:~/html$ grep -r devel-container-service /var/www/html/modules/contrib/devel/
/var/www/html/modules/contrib/devel/src/Commands/DevelCommands.php:   * @aliases devel-container-services,dcs,devel-services
/var/www/html/modules/contrib/devel/drush/devel.drush8.inc:  $items['devel-container-services'] = array(

But Drush doesn't seem to find the devel module:

www-data@39e134dc7690:~/html$ /var/www/html/vendor/bin/drush devel-container-services
[Symfony\Component\Console\Exception\CommandNotFoundException]
Command "devel-container-services" is not defined.

Are there any path settings I need to tweak to get Drush to find the Devel module?

2
  • drush cc drush; composer dump-autoload; drush cr. Any better after running that?
    – Clive
    Commented Feb 14, 2018 at 11:58
  • Thanks for the reply. I ran the commands you suggested, but unfortunately thing still fail: www-data@39e134dc7690:~/html$ export PATH=$PATH:/var/www/html/vendor/bin drush cc drush; composer dump-autoload; drush cr; drush devel-container-services Generating autoload files > Drupal\Core\Composer\Composer::preAutoloadDump > Drupal\Core\Composer\Composer::ensureHtaccess [success] Cache rebuild complete. [Symfony\Component\Console\Exception\CommandNotFoundException] Command "devel-container-services" is not defined.
    – kenneho
    Commented Feb 14, 2018 at 12:17

2 Answers 2

1

I looks like I simply had forgotten to enable (i.e install) the module in /admin/modules. I had just ran "composer require", but not actually enabled it.

0

I encountered this issue when attempting to port an older global Drush command. While following the porting instructions generated the necessary Drush code, the command was not discovered by drush because it wasn't part of an enabled module.

If this is your issue, either create a module_name.info.yml file manually, or run drush generate module, then enable the module in question. The drush command no longer threw a CommandNotFoundException.

1
  • Thanks for the reply, I'll test this when I get the chance. But before that I need to verify that I actually enabled (i.e. click "install" in the Drupal GUI) the Devel module in Drupal after installing it - it's possible I forgot to enable it.
    – kenneho
    Commented Feb 16, 2018 at 8:17

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.