I installed Drush 10.3.5 version via composer in Drupal 9.0.7 but I am getting a website error as follows after I ran command drush cache-rebuild. I can not access the admin page as well.

The website encountered an unexpected error. Please try again later.
Error: Class 'Drush\Log\DrushLog' not found in Drupal\Component\DependencyInjection\Container->createService() (line 257 of core/lib/Drupal/Component/DependencyInjection/Container.php).

I found somewhere i.e. (https://gorannikolovski.com/blog/drupal-9-and-drush-10) that Drush does not support symfony/var-dumper version 5.*. But I can't change symfony/var-dumper version in Drupal because Drupal core requires symfony/var-dumper v5.1.10 as follows:

$ composer why symfony/var-dumper

drupal/core-recommended 9.0.7 requires symfony/var-dumper (v5.1.0)
symfony/error-handler v4.4.9 requires symfony/var-dumper (^4.4|^5.0)

So please help me to fix this issue.

Please let me know which Drush version I should use with the latest Drupal version 9.0.7.

The website issue screenshot as follows:

enter image description here

Also how to fix this website issue so that I can see the front page and admin page.

Thank You

  • 1
    I’m voting to close this question because this is a bug report and bug reports must be filed with the corresponding project's issue queue, not on Drupal Answers. github.com/drush-ops/drush/issues – leymannx Oct 16 at 6:47
  • 2
    Yes @leymannx and it's probably no longer a bug, the linked issue is for an early dev version. Now Drupal 9 and Drush 10 can both use var-dumper v5.1, at least on my computer. Gundeep, did you try to restart the webserver, might be a problem with the class autoloader. – 4k4 Oct 16 at 6:50
  • Hi, thank you for your response. I have not tried to restart the webserver after Drush installation. I just clear the cache and refreshed the front page and got an error. If Drush 10 is working with Drupal 9, I can try again and will see how it goes. After Drush installation, should I restart the webserver first before clear the cache? Please let me know. Thank You. – Gundeep Oct 16 at 7:45
  • Yes, restart the webserver and then try to clear the cache again. Normally you don't need to do this, but now it could help for a loading error of a class which should be present. – 4k4 Oct 16 at 8:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.