0

Greetings to all of you.

Drush seems unable to properly find the site.

The output of vendor/drush/drush/drush status

PHP binary    : /usr/bin/php                                                   
PHP config    : /etc/php.ini                                                   
PHP OS        : Linux                                                          
Drush script  : /usr/share/site_dir/vendor/drush/drush/drush     
Drush version : 10.5.0                                                         
Drush temp    : /tmp                                                           
Drush configs : /usr/share/nginx/site_dir/vendor/drush/drush/drush.yml 
Drupal root   : /usr/share/nginx/site_dir/web/web

Please notice that the reported Drupal root shows web/web

/usr/share/nginx/site_dir/web/web

In fact the Drupal root, seems to me, should be

/usr/share/nginx/site_dir/web

Any ideas, please.

Many thanks.

4
  • I'd do a search on the code base (specifically any scaffolding files) for the strings 'web' and /web, and see what you find. Maybe you need to remove it from some configuration file somewhere. Or it may be that you've misconfigured it in NGINX somewhere. Does the site load when you access the URL set in your NGINX config?
    – Jaypan
    Commented Jul 4, 2021 at 20:27
  • Also, what directory have you executed Drush from? And do you have Drupal Finder installed with composer in your project directory?
    – Jaypan
    Commented Jul 4, 2021 at 20:28
  • Does the site load when you access the URL set in your NGINX config? Yes What directory have you executed Drush from? /usr/share/nginx/site_dir Do you have Drupal Finder installed with composer in your project directory? Can You be more specific, please. Commented Jul 4, 2021 at 20:49
  • 2
    Tanks @Jaypan. I found the problem: Somebody copied the file /usr/share/nginx/site_dir/composer.json to /usr/share/nginx/site_dir/web/composer.json Commented Jul 4, 2021 at 21:41

1 Answer 1

0

This errors gets thrown when $alteredRoot and $root do not match during Preflight. Often occurs with incorrect web-root settings in composer.json as can be seen here: https://www.drupal.org/forum/support/upgrading-drupal/2023-08-09/drush-unavailable-after-drupal-upgrade-from-9510-to-1012

In my case there was an extra composer.json in /web (just like the original poster). Removing this resolved it for me. But other solutions offered in the D.O topic might be helpful for some, so thought to share this.

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.