Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drush commands error with "env: drush9: No such file or directory #2105

Closed
justinlevi opened this issue Oct 6, 2017 · 13 comments
Closed

Drush commands error with "env: drush9: No such file or directory #2105

justinlevi opened this issue Oct 6, 2017 · 13 comments
Labels
Bug Something isn't working
Milestone

Comments

@justinlevi
Copy link
Contributor

My system information:

  • Operating system type: Mac OS 10.12.6
  • BLT version: 8.9.7
justinwinter in ~/Sites/blt [-b develop*]
⚡ composer info acquia/blt
name     : acquia/blt
descrip. : BLT
keywords : automation, deployment, drupal, template, testing
versions : * 8.9.7

When I run this command:

$ drush @projectname.dev status -v

I get the following output:

[info] Loaded alias @askwebny.dev from file /Users/justinwinter/Sites/blt/docroot/../drush/site-aliases/askwebny.aliases.drushrc.php
 [info] Begin redispatch via drush_invoke_process().
Calling proc_open(ssh -o PasswordAuthentication=no -t askwebny.dev@askwebnygwh6rece5t.ssh.devcloud.acquia-sites.com 'env COLUMNS=173 drush9  --root=/var/www/html/askwebny.dev/docroot --verbose --uri=http://blt.dev  core-status 2>&1' 2>&1);
env: ‘drush9’: No such file or directory
Connection to askwebnygwh6rece5t.ssh.devcloud.acquia-sites.com closed.
 [info] End redispatch via drush_invoke_process().
 [info] Begin redispatch via drush_invoke_process().
Calling proc_open(ssh -o PasswordAuthentication=no askwebny.dev@askwebnygwh6rece5t.ssh.devcloud.acquia-sites.com 'env COLUMNS=173 drush9  --verbose --root=/var/www/html/askwebny.dev/docroot --uri=http://blt.dev  core-status 2>&1' 2>&1);
env: ‘drush9’: No such file or directory
 [info] End redispatch via drush_invoke_process().

And I expected this to happen:

The command to work

referencing comits/issues :
#856
#867

@justinlevi
Copy link
Contributor Author

justinlevi commented Oct 6, 2017

Here's my askwebny.aliases.drushrc.php

<?php

if (!isset($drush_major_version)) {
  $drush_version_components = explode('.', DRUSH_VERSION);
  $drush_major_version = $drush_version_components[0];
}
// Site askwebny, environment dev.
$aliases['dev'] = array(
  'root' => '/var/www/html/askwebny.dev/docroot',
  'ac-site' => 'askwebny',
  'ac-env' => 'dev',
  'ac-realm' => 'devcloud',
  'uri' => 'askwebnygwh6rece5t.devcloud.acquia-sites.com',
  'remote-host' => 'askwebnygwh6rece5t.ssh.devcloud.acquia-sites.com',
  'remote-user' => 'askwebny.dev',
  'path-aliases' => array(
    '%drush-script' => 'drush' . $drush_major_version,
  ),
);
$aliases['dev.livedev'] = array(
  'parent' => '@askwebny.dev',
  'root' => '/mnt/gfs/askwebny.dev/livedev/docroot',
);

if (!isset($drush_major_version)) {
  $drush_version_components = explode('.', DRUSH_VERSION);
  $drush_major_version = $drush_version_components[0];
}
// Site askwebny, environment test.
$aliases['test'] = array(
  'root' => '/var/www/html/askwebny.test/docroot',
  'ac-site' => 'askwebny',
  'ac-env' => 'test',
  'ac-realm' => 'devcloud',
  'uri' => 'askwebnyzrsm4s5quz.devcloud.acquia-sites.com',
  'remote-host' => 'askwebnyzrsm4s5quz.ssh.devcloud.acquia-sites.com',
  'remote-user' => 'askwebny.test',
  'path-aliases' => array(
    '%drush-script' => 'drush' . $drush_major_version,
  ),
);
$aliases['test.livedev'] = array(
  'parent' => '@askwebny.test',
  'root' => '/mnt/gfs/askwebny.test/livedev/docroot',
);

This is taken directly from acquia cloud provided alias file and dropped into my blt/drush/site-aliases file.

@grasmash
Copy link
Contributor

grasmash commented Oct 6, 2017

Technically, this is a bug in Acquia cloud rather than BLT. We worked around this issue previously by using policy.drush.inc, which was loaded automatically by drush/drushrc.php.

Unfortunately, drush 9 no longer automatically loads that configuration. You can manually load it by executing: drush @projectname.dev status --config=drush/drushrc.php -v.

This may be a bug in drush, or we may need to change where we put configuration in BLT. I'm not sure.

@grasmash grasmash added the Bug Something isn't working label Oct 6, 2017
@grasmash
Copy link
Contributor

grasmash commented Oct 6, 2017

drush-ops/drush#3027

@grasmash grasmash added the sprint label Oct 6, 2017
@justinlevi
Copy link
Contributor Author

Hmmm, adding that --config settings doesn't seem to fix it for me either.

$ drush @askwebny.dev status --config=drush/drushrc.php -v

 [info] Loaded alias @askwebny.dev from file /Users/justinwinter/Sites/blt/docroot/../drush/site-aliases/askwebny.aliases.drushrc.php
 [info] Begin redispatch via drush_invoke_process().
Calling proc_open(ssh -o PasswordAuthentication=no -t askwebny.dev@askwebnygwh6rece5t.ssh.devcloud.acquia-sites.com 'env COLUMNS=219 drush9  --root=/var/www/html/askwebny.dev/docroot --config=drush/drushrc.php --verbose --uri=askwebnygwh6rece5t.devcloud.acquia-sites.com  core-status 2>&1' 2>&1);
env: ‘drush9’: No such file or directory
Connection to askwebnygwh6rece5t.ssh.devcloud.acquia-sites.com closed.
 [info] End redispatch via drush_invoke_process().
 [info] Begin redispatch via drush_invoke_process().
Calling proc_open(ssh -o PasswordAuthentication=no askwebny.dev@askwebnygwh6rece5t.ssh.devcloud.acquia-sites.com 'env COLUMNS=219 drush9  --config=drush/drushrc.php --verbose --root=/var/www/html/askwebny.dev/docroot --uri=askwebnygwh6rece5t.devcloud.acquia-sites.com  core-status 2>&1' 2>&1);
env: ‘drush9’: No such file or directory
 [info] End redispatch via drush_invoke_process().

Reviewing your link now

@grasmash
Copy link
Contributor

grasmash commented Oct 6, 2017

The Drush team is planning on releasing a new version of drush 8 today which will work with Drupal 8.4. That will be the best temporary solution.

What version of drush are you running globally? Do you have this line in your file https://github.com/acquia/blt/blob/9.x/template/drush/drushrc.php#L4 ?

Can you try rebuilding your drush caches using that config parameter?

@justinlevi
Copy link
Contributor Author

Good to know that a new version of drush 8 is coming out today. Hopefully that will fix things...

⚡ composer info drush/drush

name     : drush/drush
versions : * 9.0.0-beta4

I'm assuming you meant rebuild your drush caches right? I'm not sure I know what "trust" caches are ;)

I did NOT have $options['include'][] = __DIR__; in my [project_root]/drush/drushrc.php

@grasmash
Copy link
Contributor

grasmash commented Oct 6, 2017

This issue is essentially blocked by drush-ops/drush#3017 (comment)

@justinlevi
Copy link
Contributor Author

I was able to work around the issue by downgrading drush to 8.1.14 in my blt project.

[project-root]/composer.json

...
    "require-dev": {
        "drush/drush": "^8.1.13"
    },
...

@grasmash grasmash added drush and removed blocked labels Oct 9, 2017
@grasmash
Copy link
Contributor

grasmash commented Oct 9, 2017

Unblocked by drush-ops/drush#3017.

@grasmash grasmash added this to the Complete Drush 9 port milestone Oct 10, 2017
@grasmash
Copy link
Contributor

This might have been resolved by https://github.com/acquia/blt/pull/2142/files#diff-f2c085852879884c29b25db6105e721aR8. Needs testing.

@grasmash
Copy link
Contributor

grasmash commented Oct 16, 2017

Actually, that change is invalid. drush-script: drush8 needs to be added to the drush cloud alias, which isn't managed by BLT.

This should really be fixed in the Acquia Cloud default aliases, but BLT could dynamically alter the aliases (like it used to) as a bandaid. However, hook_drush_sitealias_alter() does not yet have an equivalent in drush 9.

This should be considered either blocked or won't fix.

@grasmash
Copy link
Contributor

I think that we can resolve this in BLT by generating our own aliases. This issue should then be closed when #2157 is completed.

@danepowell
Copy link
Contributor

danepowell commented Nov 14, 2017

You'll need to generate Drush 9 compatible versions of your alias files (e.g. foo.alias.yml). Once you do this (get rid of your old php-based aliases) you should no longer encounter this error.

BLT 9.1.0 will generate these new alias files automatically thanks to #2157, but for BLT 9.0.0 and earlier versions you'll need to generate these new alias files manually. Unfortunately we can't backport that feature since it requires PHP 7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants