I'm trying to write a drush command for a module and getting this error even though the module in question is enabled.
Here's my output:
$ drush field-tools-clone foobar foo bar --debug
Warning: Module 'pdo_mysql' already loaded in Unknown on line 0
Bootstrap to phase 0. [0.01 sec, 4.5 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drush() [0.01 sec, 4.76 MB] [bootstrap]
Loading drushrc "/Users/joachim/Sites/_sandbox/drush/drushrc.php" into "drush" scope. [0.01 sec, 4.77 [bootstrap]
MB]
Include /Users/joachim/Library/Drush [0.02 sec, 4.78 MB] [notice]
Cache HIT cid: 6.0-dev-commandfiles-0-4f23bb0e449e8457facd4296a84bdfd3 [0.02 sec, 4.79 MB] [debug]
Bootstrap to phase 0. [0.07 sec, 10.33 MB] [bootstrap]
Bootstrap to phase 5. [0.09 sec, 10.33 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_root() [0.1 sec, 10.33 MB] [bootstrap]
Initialized Drupal 7.14 root directory at /Users/joachim/Sites/mysite [0.12 sec, 14 MB] [notice]
Drush bootstrap phase : _drush_bootstrap_drupal_site() [0.12 sec, 14 MB] [bootstrap]
Initialized Drupal site default at sites/default [0.13 sec, 14.01 MB] [notice]
Cache HIT cid: 6.0-dev-commandfiles-2-c32acd775c18a90c5b41d0fc9accf5ab [0.13 sec, 14.01 MB] [debug]
Drush bootstrap phase : _drush_bootstrap_drupal_configuration() [0.13 sec, 14.01 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_database() [0.16 sec, 17.09 MB] [bootstrap]
Successfully connected to the Drupal database. [0.16 sec, 17.09 MB] [bootstrap]
Drush bootstrap phase : _drush_bootstrap_drupal_full() [0.16 sec, 17.09 MB] [bootstrap]
Cache HIT cid: 6.0-dev-commandfiles-5-4f2ed1ff17e7bc82af6797efd2a4cb05 [0.7 sec, 57.99 MB] [debug]
Cache HIT cid: 6.0-dev-commandfiles-2-1c82782e4f0daa661b06df029df9c6f1 [0.96 sec, 60.87 MB] [debug]
Command field-tools-clone needs the following module(s) enabled to run: field_tools. [1.01 sec, 61.26 [error]
MB]
The drush command 'field-tools-clone foobar foo bar' could not be executed. [1.01 sec, 61.26 MB] [error]
I've checked that this is not due to #1493022: improve readme and add "have command line use same php as webserver" for hint for "needs a higher bootstrap level to run" error -- the warning about pdo_mysql has started appearing now that I've copied my MAMP php.ini to ~/.drush/php.ini.
Here's my status output:
$ drush status
Warning: Module 'pdo_mysql' already loaded in Unknown on line 0
Drupal version : 7.14
Site URI : http://default
Database driver : mysql
Database hostname : localhost
Database username : drupal
Database name : drupal-mysite
Database : Connected
Drupal bootstrap : Successful
Drupal user : Anonymous
Default theme : bartik
Administration theme : garland
PHP configuration : /Users/joachim/.drush/php.ini /Users/joachim/.drush/php.ini
Drush version : 6.0-dev
Drush configuration : /Users/joachim/Sites/_sandbox/drush/drushrc.php
Drupal root : /Users/joachim/Sites/mysite
Site path : sites/default
File directory path : sites/default/files
Private file directory path : sites/default/files/private
temp : /Applications/MAMP/tmp/php
Comments
Comment #1
joachim CreditAttribution: joachim commentedOK the problem seems to be that the cache needed clearing.
If drush finds a command is missing from the cache, could it perhaps do a clear of its cache itself?
Comment #2
jonhattanIf a command is missing from the cache drush will ask you to clear the cache. But it doesn't seem to be the problem here as the command was already found.
I think the «Command field-tools-clone needs the following module(s) enabled to run: field_tools.» error could be raised under other circumstances (see drush.php).
@joachim can you enum the steps to reproduce this?
Comment #3
seanrI just encountered this - no idea why it happened, but drush cc drush as indicated above fixed it. This was on my local machine (OSX Lion) and a site I've been working with quite a bit over the last few weeks.
Comment #4
userofdrupal CreditAttribution: userofdrupal commenteddrush cc also fixed the issue for me.
Comment #5
pjcdawkins CreditAttribution: pjcdawkins commentedAnd that's the bug, isn't it?
I run "drush elysia-cron" from crontab, and because of this drush behaviour, cron didn't run for several hours, and that meant a scheduled article failed to publish at the right time (which is embarrassing!). My workaround for now is to run "drush cc drush" in another cron job, slightly less often.
It doesn't just happen when modules are enabled/disabled - it appears to happen after other commands such as updatedb.
Comment #6
mikran CreditAttribution: mikran commentedI've just encountered this as well. I updated Drush to latest version and performed cc all afterwards but I found out the hard way that you need to do cc with each user separately.
Comment #7
broon@mikran: Your sudo line actually pointed me to a solution for my problem where I wasn't able to get a drush command to run (see #1953246: Command fieldcopy needs the following module(s) enabled to run: field. for details of my specific problem). Short version in case someone stumbles upon the same issue:
Comment #8
geerlingguy CreditAttribution: geerlingguy commentedI just ran into the problem as well.
$ drush cc drush
fixed it.Comment #9
pjcdawkins CreditAttribution: pjcdawkins commentedRight, but that's a band-aid, not a cure.
Comment #10
greg.1.anderson CreditAttribution: greg.1.anderson commentedThis issue was marked
closed (won't fix)
because Drush has moved to Github.If desired, you may copy this bug to our Github project and then post a link here to the new issue. Please also change the status of this issue to
closed (duplicate)
.Please ask support questions on Drupal Answers.
Comment #11
joachim CreditAttribution: joachim commentedhttps://github.com/drush-ops/drush/issues/79
Comment #11.0
joachim CreditAttribution: joachim commentedadded debug
Comment #12
rahulbaisanemca CreditAttribution: rahulbaisanemca commenteddrush cc all solved my problem
Thanks.