FatalError when trying to install/uninstall a module.
Hello!
I decided to experiment with SEO and install the Visitors module. I wish I hadn't. The module installation was interrupted by a fatal error: Fatal error: Call to a member function getRoles() on null in <...>khabastro.ru/modules/visitors/src/EventSubscriber/KernelTerminateSubscriber.php on line 43.
Alright, I thought, Drupal 8 doesn’t have global $user, so I fixed that. After that, errors started appearing in the same file about non-existent standard functions like request_uri(). I somehow managed to work around it (though what’s the point of the module then), but the errors kept appearing. I gave up and tried to uninstall the module, but no luck: "An unexpected error occurred on the site. Please try again later."
...and the last error text is also displayed. Please advise how to get rid of this module and also how to avoid such module behavior in the future? This error now appears on every page of the site and is visible to everyone :( Thank you!