I am trying to integrate ElasticSearch with Drupal and till now everything seems to be working except that the command drush sapi-i crashes with the output:

> 'C:/xampp/htdocs/my-project/docroot/vendor/bin/drush' is not recognized as an internal or external command,
> operable program or batch file.

In ProcessBase.php line 172:

  Output is empty.

search-api:index [--limit [LIMIT]] [--batch-size [BATCH-SIZE]] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-d|--debug] [-y|--yes] [--no] [--remote-host REMOTE-HOST] [--remote-user REMOTE-USER] [-r|--root ROOT] [-l|--uri URI] [--simulate] [--pipe] [-D|--define DEFINE] [--druplicon] [--notify [NOTIFY]] [--xh-link XH-LINK] [--] <command> [<indexId>]

After debugging with drush sapi-i -d it seems the call to drush_backend_batch_process() causes the issue for some reason.

1 Answer 1


After checking the vendor/bin directory I noticed that the drush script exists but drush.bat or drush.cmd were missing, I mean, for some reason even though I executed the drush sapi-i command using Git-bash, Drupal was still trying to access the Windows type of the file (which didn't exist in the source I copied from Mac). so creating the below file manually fixed the issue.

drush.cmd file:

@echo off
php "%~dp0../drush/drush/drush" %*

drush file:

#!/usr/bin/env sh

dir=$(cd "${0%[/\\]*}" > /dev/null; cd '../drush/drush' && pwd)

if [ -d /proc/cygdrive ]; then
    case $(which php) in
        $(readlink -n /proc/cygdrive)/*)
            # We are in Cygwin using Windows php, so the path must be translated
            dir=$(cygpath -m "$dir");

"${dir}/drush" "$@"

Note that the drush script's line ending should be LF (instead of CRLF which drush.cmd needs), so in Git-bash simply cd to where your script is and run sed -i 's/\r$//' my-script-filename (if your editor can only save with CRLF).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.