I have a drupal installation running in a vagrant virtual machine. This works fine, but when I try to use Drush on this site I get very peculiar behavior. The modules that are listed when I run "drush pm-list" are all from a non-existent Drupal 8 installation. I have tried setting --root= and --uri= but to no avail. Drush simply ignores my real Drupal 7 installation and instead outputs non-existent modules from a non-existent installation??


Try running drush from inside the VM.

First, use vagrant ssh to get inside.

Then, change directory to the docroot:

cd /vagrant/docroot/

You should be able to run Drush commands from there.

In theory, if you know how to set up Drush aliases, you won't need to do that, but this method is a useful shortcut.

Let me know if it works -- and good luck!

| improve this answer | |

Thanks for the suggestion, but I figured out what was going on. It turns out that when vagrant sets up a virtual machine, it creates a version of drush that is 8.(something). It also turns out that version 8 of drush is not compatible with Drupal v7 which is what my site is. In order to get drush to work I had to download an earlier version (I ended up with 5.9). Once I did that, everything worked just fine.

| improve this answer | |

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.