Getting error for artisan commands ( In routes-v7.php Call to undefined method Closure::__set_state() )

I have upgraded Laravel version from 5.7 to 8.34. I'm getting this error for all artisan commands.

enter image description here


Solution 1:

To others: removing the routes-v7 might help, but it's possibly caused due to a return in your routes file (web.php). Remove it and use a controller to return a specific view/back() etc.