Laravel error - Class setEventDispatcher does not exist

So this is what usually fixes it for me

  1. Reinstall composer dependencies by removing vendor folder and composer.lock. Then run composer clear-cache and then composer install (this is usually the problem)

  2. Check that all service providers are imported correctly in app.php under directory config

  3. Make sure that your service providers are not importing something that does not exist, for example if you register a service provider in production but is only installed as dev:

    if (env('APP_DEBUG')) { $app->register(Barryvdh\Debugbar\LumenServiceProvider::class); }


Tried every solution, none of them worked.

Finally, i realised that when trying to upgrade php to 7.3.3 it was infact a network error that caused the fail. Read the logs, tried again, restarted valet and tried again.

It works now.

Upgrading to 7.3.3 was the solution indeed.

Thank you!


If you use valet, I solved it running

valet restart and all works fine.

cheers!

Tags:

Laravel