I've encountered a problem when using drush. It seems that the DIR variable doesn't point to the right directory.
It should point to '/vendor/drush/drush/includes/' (that's where the preflight.inc is) instead of '/vendor/bin/includes/'.
Here is the error I get:
Warning: require(/Users/xxx/xxx/drupal/vendor/bin/includes/preflight.inc): failed to open stream: No such file or directory in /Users/xxx/xxx/drupal/vendor/bin/drush.php on line 11
Fatal error: require(): Failed opening required '/Users/xxx/xxx/drupal/vendor/bin/includes/preflight.inc' (include_path='.:') in /Users/xxx/xxx/drupal/vendor/bin/drush.php on line 11
I hope someone can help me (I'm more a frontend- than a backend-dev).
Thanks in advance!
Can you share some information about your environment? What is your drush and php version? Thanks!
I'm running drupal on MAMP with PHP 7.0 and drush version 8.1.2 and everything works fine except for drush (have not tried drupal console yet). Thanks for the help!
I found out another thing that could help solve my issue. I hardcoded the right path to preflight.inc into drush.php and _which drush_ tells me it is using a global drush (/usr/local/lib/drush/drush) instead of the local dependency drush.
But still don't know how I can fix that, unfortunately.
@projekt8 The global drush dispatches the command to the local drush automatically, just make sure that your global drush is up to date. The feature has been added a few months ago.
@webflo local and global drush have the same version (8.1.2) but auto dispatching doesnt seem to work
Same happening for me. But the funny thing is, that I have a working copy with almost same file structure, and same files indeed, and one is working, another is not.
UPDATE:
My problem was, that I used a not-symlink friend copy mechanism, and the symlinks were replaced with the actual files. That's why the include command tried to load from the wrong directory.
Just in case anyone else lands here like I did, my error was a mistyped PATH (using XAMPP and Windows)
Found this after searching for the same error message. The problem, and solution, lay in my environment setup as I am running a multi-site instance on a 1&1 shared Linux hosting package.
Setup Drush using composer http://www.daveboulden.co.uk/index.php/2015/03/03/installing-drush-7-on-11-unlimited-shared-hosting/
My .profile contains the following:
export PATH="~/.composer/vendor/bin:$PATH"
alias composer='/usr/bin/php5.5-cli ~/composer/composer.phar'
alias drush='/usr/bin/php5.5 ~/.composer/vendor/drush/drush/drush.php --php=/usr/bin/php5.5'
export DRUSH_PHP='/usr/bin/php5.5-cli'
export COLUMNS
Due to my multi-site setup I need to execute Drush inside my Drupal root folder using the _--uri_ argument for each site.
Hope this helps others
If you come across this problem (or a similar message about startup.inc, or drupal.php when attempting to run Drupal Console), be sure the contents of vendor/bin are actually symlinks.
Moving a project to a new laptop, the actual PHP scripts were copied to vendor/bin rather than the symlinks, which caused this error for me (the include paths in the scripts are no longer valid in that case). The following steps resolved the issue for me:
$ rm vendor/bin/*
$ composer install
My problem also was that the files instead of the symlinks were in the /vendor/bin directory. Running the script from the erronous /vendor/bin dir leads to mismatched directory structure.
Deleting the scripts and replacing the sylinks did the trick for me.
Just to add my 2 cents: I had this very same issue because I ran "composer update" on my initial project instead of running "composer install". The update pulled in all the files into the bin directory but they were not symlinks. I followed Andy's steps and that fixed the issue.
Most helpful comment
If you come across this problem (or a similar message about startup.inc, or drupal.php when attempting to run Drupal Console), be sure the contents of vendor/bin are actually symlinks.
Moving a project to a new laptop, the actual PHP scripts were copied to vendor/bin rather than the symlinks, which caused this error for me (the include paths in the scripts are no longer valid in that case). The following steps resolved the issue for me: