framework: [5.3] Uncaught ReflectionException: Class view does not exist

  • Laravel Version: 5.3
  • PHP Version: 7.0
  • Database Driver & Version: Mysql

Description:

When run the project,Laravel give me this exception “Class view does not exist” . But why ?

Steps To Reproduce:

Stack trace:
#0 /var/lib/php/composer_package/vendor/laravel/framework/src/Illuminate/Container/Container.php(749): ReflectionClass->__construct('view')
#1 /var/lib/php/composer_package/vendor/laravel/framework/src/Illuminate/Container/Container.php(644): Illuminate\Container\Container->build('view', Array)
#2 /var/lib/php/composer_package/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(709): Illuminate\Container\Container->make('view', Array)
#3 /var/lib/php/composer_package/vendor/laravel/framework/src/Illuminate/Container/Container.php(1203): Illuminate\Foundation\Application->make('view')
#4 /var/lib/php/composer_package/vendor/laravel/framework/src/Illuminate/Routing/RoutingServiceProvider.php(144): Illuminate\Container\Container->offsetGet('Illuminate\\Cont...')
#5 /var/lib/php/composer_package/vendor/laravel/framework/src/Illumin in /var/lib/php/composer_package/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 749
[22-Feb-2017 01:52:33 UTC] PHP Fatal error:  Uncaught ReflectionException: Class view does not exist in /var/lib/php/composer_package/vendor/laravel/framework/src/Illuminate/Conta

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 19 (4 by maintainers)

Most upvoted comments

in my case was a comma missing in the config/app providers array, or like i read in another post an space in the .env file

I fixed this by formatting my pc and replacing the AC system in the office.

I fixed this by modifying project dir’s permissions

In my case I had to run composer update and then composer dump-autoload. There was change in my dependencies.

Whenever i receive these kind of errors, i try to run php artisan in the command line as it shows where the error lies. Mostly due to errors in env file like a space. For example FACEBOOK_ID={{API Key}} FACEBOOK_SECRET={{API secret}} FACEBOOK_URL={{callbackurl}} Changing API Key to API_Key if not specified or keeping it blank FACEBOOK_ID= shall fix the error if caused by a whitespace

Solved this issue after removing space in the .env file (view .env in sublime because vi editor doesn’t show space at end of the .env file.) and run below commands.

Commands:

php artisan config:clear php artisan cache:clear composer dump-autoload php artisan clear-compiled

@epileftro85 thank you. it’s work now. i just found a word on my .env file.

Had the same issue, after running composer dump-autoload, I discovered it was because I had forgotten to install a package (Laravel Excel) I had setup on my dev server that wasn’t yet loaded on the production server.

In case anyone else exhausts the other options above, for me it was because I was throwing an exception in a package-overriding config file.

Lesson: don’t throw exceptions from your config files.

P.S. I’m running 5.5