0

I'm trying to enable the module Elasticsearch connector on Drupal test site (hosted on pantheon.io) and here is what happens:

Drush 9 error: command pm:enable is not defined

This error seems not to be frequent since I'm unable to find how to resolve it on SO.

If you have any idea about what goes wrong, this would be great.

Thank you!

Drush version: 9.2.1 Drush luncher version: 0.6.0

alch3mist
  • 1
  • 2

4 Answers4

0

This error could appear, for example, after "starting" drupal installation, using for example:

composer create-project drupal-composer/drupal-project:8.x-dev some-dir --stability dev --no-interaction

You could think... Well, job done! But you've just download the code... After it you should start own drupal install process, using web GUI or drush, from previous example dir "some-dir":

../vendor/bin/drush site:install

Then drush ask you for database details which you previously create.

After it, "drush en some_module" run as expected ;-)

calbasi
  • 1
  • 1
0

There were some incompatible changes between Drush 8 and Drush 9. If you have a Drush script/command just to print out phpinfo, and run it under Drush 8 and Drush 9 separately, you will see that some environment variables under $_SERVER may have different values, like

  • $_SERVER['PWD']
  • $_SERVER['HTTP_HOST']
  • $_SERVER['REQUEST_URI']
  • $_SERVER['PHP_SELF']
  • ......

Thus, if you use variable $_SERVER in your settings.php to initialize settings for your Drupal site, then some Drush commands/scripts may not work under Drush 9 as before.

Although we can't exactly tell which caused the issue you experienced, here are my suggestions for it:

  • If you happen to use Drupal 8.4.x, the issue could be fixed automatically if you upgrade to Drupal 8.5.0+, which was out already half month ago. (suggested)
  • Update your settings.php file accordingly if it has $_SERVER variable(s) in use.
deminy
  • 121
  • 6
0

In my case I had to install the mysql-client in my web container. For some reason drush is using the mysql cli directly and doesn't use the PHP driver.

Tip: use drush -vvv and look for any warnings!

Zoe
  • 27,060
  • 21
  • 118
  • 148
Asim
  • 579
  • 4
  • 6
0

Try to install the module using drupal console

//Command to install a module
drupal moi

it will provide an auto complete interface for module name which is mush easier than drush

Razeem Ahmad
  • 391
  • 1
  • 11