Ad

ReflectionException In Container.php Line 741: Class View Does Not Exist

I'm working on a Laravel 5.1 project with Homestead. I shelled into my Vagrant machine and ran the Composer Update command in an attempt to try to update my project and now I get the following error:

    1. in Container.php line 741
    2. at ReflectionClass->__construct('view') in Container.php line 741
    3. at Container->build('view', array()) in Container.php line 631
    4. at Container->make('view', array()) in Application.php line 674
    5. at Application->make('Illuminate\Contracts\View\Factory') in Container.php line 842
    6. at Container->resolveClass(object(ReflectionParameter)) in Container.php line 805
    7. at Container->getDependencies(array(object(ReflectionParameter)), array()) in Container.php line 776
    8. at Container->build('Illuminate\View\Middleware\ShareErrorsFromSession', array()) in Container.php line 631
    9. at Container->make('Illuminate\View\Middleware\ShareErrorsFromSession', array()) in /home/vagrant/Sites/laravel-basics/vendor/laravel/framework/src/Illuminate/Foundation/Application.php line 674
   10. at Application->make('Illuminate\View\Middleware\ShareErrorsFromSession') in Pipeline.php line 123
   11. at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in StartSession.php line 62
   12. at StartSession->handle(object(Request), object(Closure))
   13. at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
   14. at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
   15. at AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
   16. at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
   17. at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in EncryptCookies.php line 59
   18. at EncryptCookies->handle(object(Request), object(Closure))
   19. at call_user_func_array(array(object(EncryptCookies), 'handle'),  array(object(Request), object(Closure))) in Pipeline.php line 124
   20. at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in CheckForMaintenanceMode.php line 44
   21. at CheckForMaintenanceMode->handle(object(Request), object(Closure))
   22. at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in Pipeline.php line 124
   23. at Pipeline->Illuminate\Pipeline\{closure}(object(Request))
   24. at call_user_func(object(Closure), object(Request)) in Pipeline.php line 103
   25. at Pipeline->then(object(Closure)) in Kernel.php line 122
   26. at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 87
   27. at Kernel->handle(object(Request)) in index.php line 54

I'm not sure what broke. I had already been working in Laravel 5.1 and Composer was running just fine. I feel that I have two basic options: 1) try to revert back tot he previous version of Composer or 2) revert to a previous version of my project. However, is there a simpler fix for this?

Ad

Answer

Make sure that you have Illuminate\View\ViewServiceProvider listed in the list of providers in your config/app.php file.

Apparently there is no view service in the container and this is the provided that sets it up.

Ad
source: stackoverflow.com
Ad