Score:0

How to Fix drush installation - path or alias to drupal root

cn flag

I had 10.6.2 working - on Centos 7 and today it is just GONE. I had to remove phpunit and apparently it took the drush pathing setup for drush with it. Now it says it is installed but the command is not found if I run " composer require drush/drush:10.6.2 "

If I go to /public_html/vendor/drush/drush and run ./drush it is there but gives the error " ! [NOTE] Drupal root not found. Pass --root or a @siteAlias in order to see Drupal-specific commands. "

How do I get this pathed back to the drupal root ??

leymannx avatar
ne flag
Don't go to Drush, go to your web root, as in `cd web/` and then type `../vendor/drush/drush/drush cr` or install the [Drush Launcher](https://github.com/drush-ops/drush-launcher) on your machine to just do `drush cr`.
cn flag
./vendor/drush/drush/drush cr rebuilt the cache, but did not fix the path problem (one dot from webroot)
leymannx avatar
ne flag
Execute the command from within the directory where Drupal's index.php file is located – the web root. Not the project root. See https://drupal.stackexchange.com/q/309223/15055. What command are you executing exactly when the error gets raised?
cn flag
./vendor/drush/drush/drush cr means it IS executed from the Drupal root where index.php is. drush cr is short for drush cache-rebuild, it does not fix pathing; howeveer I think I see what happened. I use RPM files where possible for global installation files. I had drush-8.1.16-1.el7.remi.noarch.rpm installed which included phpunit 5.7 so I uninstalled it to install phpunit9.by rpm, but it did not upgrade phpunit 5, and that took "drush.launcher" off which was somehow launching 10.6.2 from the command line anywhere. I will have to hack it back onto the server to get "drush.launcher" back
Score:1
cn flag

Best solution was to straight use Drush Launcher ( https://github.com/drush-ops/drush-launcher ) If you use WinSCP it is really easy to move it into the path, rename it "drush", make it executable and it will find the version of drush when executed via command line from inside the Drupal installation. The nice thing is there can be different versions of drush in different Drupal verson installations - like version 8 drush installed in Drupal 7 and inside that Drupal it will use that version of drush installed Fast and easy

Score:0
cn flag

Make sure you have a composer.json file in the site root.

If there is no composer.json you always get the error "! [NOTE] Drupal root not found. Pass --root or a @siteAlias in order to see Drupal-specific commands. "

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.