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

Created on 22 Feb 2017  路  19Comments  路  Source: laravel/framework

  • 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

Most helpful comment

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

All 19 comments

I fixed this by modifying project dir's permissions

By modifying them to..?

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

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

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

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

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

in my case it was the .env file went awol throwing this error

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

Check SELinux. that was the problem for me. Particularly the config one..

Using sudo, if you setenforce permissive and it works, then turn it back setenforce enforcing on and follow below.

SELinux laravel setup:

semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/site/laravel/storage(/.*)?"
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/site/laravel/bootstrap/cache(/.*)?"
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/site/laravel/config(/.*)?"
restorecon -Rv /var/www/site/

Create .env file with your params.

in my case:i had deleted the folder of vendor,reinstall all dependencies,the problem solved.

check php version. it must be >= 7.2.

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

In my case it was an issue with the app key in my .env file. Run php artisan key:generate only if you don't rely on it for encryption and other things.

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.

Same Problem like @dylanglockler fix it

I'm locking this issue because it either has gone off-topic, become a dumping ground for things which shouldn't be in an issue tracker or is just too old.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PhiloNL picture PhiloNL  路  3Comments

lzp819739483 picture lzp819739483  路  3Comments

jackmu95 picture jackmu95  路  3Comments

klimentLambevski picture klimentLambevski  路  3Comments

felixsanz picture felixsanz  路  3Comments