0

I'm managing Drupal 7 and Drupal 8 sites, so I'm running Drush 8 as that's the only version that can manage both. The Drupal 8 sites are installed using Composer and my local setup runs on MAMP 5.5.1.
It works fine for the Drupal 7 sites, and rsync works for the Drupal 8 sites as well. However, sql-sync fails. When I run drush sql-sync @local.dup @prod.dup, I get the following messages.

Warning: require(/Users/username/path/to/local/vendor/bin/drush.php): failed to open stream: No such file or directory in /Users/username/path/to/localvendor/bin/drush on line 4
Fatal error: require(): Failed opening required '/Users/username/path/to/local/vendor/bin/drush.php' (include_path='.:') in /Users/username/path/to/local/vendor/bin/drush on line 4
The command could not be executed successfully (returned: [error] Warning: require(/Users/username/path/to/local/vendor/bin/drush.php): failed to open stream: No such file or directory in /Users/username/path/to/local/vendor/bin/drush on line 4
Fatal error: require(): Failed opening required '/Users/username/path/to/local/vendor/bin/drush.php' (include_path='.:') in /Users/username/path/to/local/vendor/bin/drush on line 4, code: 255)
The Drush sql-dump command did not report the path to the dump file produced. Try upgrading the version of Drush you are using on the source machine.

I get similar errors when checking drush @local status and drush @remote status as well as when I try to use the Drush 9 included in each site ( cd path/to/docroot > vendor/bin/drush @self @remote).

I've tried removing all Drush instances and installing only the same version that my host (cloudways) uses on the remote server (Drush 8.0.5) with no luck. I've installed Drush using CGR as instructed on Install (alternatives).
I've also checked my alias' file in the global Drush folder multiple times and can't find any issues.

What can I do from here to debug and resolve the issue?

  • 1
    some D7 and D8-sites so I'm running Drush 8 as that's the only version that can manage both. – That's somewhat wrong. See docs.drush.org/en/master/install/#drupal-compatibility – leymannx Nov 25 '19 at 14:45
  • Not true. That chart specifically shows drupal 8 support, though partial, for drush 8. I don't think we should assume that "manage both" means full support. – mradcliffe Nov 25 '19 at 17:59
  • Thanks guys. I basically only use Drush for rsync, sql-sync and clearing the cache, so I thing Drush 8 should be fine, right? – Kristoffer Rom Nov 25 '19 at 21:45
  • If it works for you. But it's not recommended. And especially when handling app critical things like the database you should better be using a version that fully supports your Drupal 8.4+. – leymannx Nov 26 '19 at 8:46
  • OK, but as I'm still getting the same error when using the site-specific Drush 9 commands as described in the question, I guess the errors aren't due to the global Drush 8 installation, right? – Kristoffer Rom Nov 26 '19 at 13:29
0

I ended up running two global drush installs as explained here.

I needed to make to use same versions of Drush 9 both globally and on the site-specific installs to not get any errors. Now both Drush 8 and Drush 9 seem to run smoothly alongside each-other.

| 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.