All of a sudden, on a commit which had nothing to do with drush as far as I can tell, drush stopped working on platform.sh. I got an error like this:


env: drush: No such file or directory

Which is to say, “no drush here.” But why? It’s added in composer. Nothing changed. I ran platform drush-aliases and refreshed them.

Stop asking why. Here’s how I fixed it.

Turns out that drush still exists on the server, even though which drush led to nothing. Not in the path? Unclear.

Here’s how I fixed it. Or worked around it.

On my local, at ~/.drush/policy.drush.inc, I added:

function policy_drush_sitealias_alter(&$alias_record) {
if ($alias_record[‘#group’] == ‘my-group-name’) {
$alias_record[‘path-aliases’][‘%drush-script’] = ‘/app/vendor/drush/drush/drush’;
}
}

Yeah weird. Whatever.