Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Class 'App\Providers\AppServiceProvider' not found

I have changed my application by using command

php artisan app:name [app_name].

Then, when I try to perform other actions using following artisan commands,

php artisan down

php artisan up

php artisan config:cache

I got the following error:

PHP Fatal error:  Class 'App\Providers\AppServiceProvider' not found

enter image description here

How can I solve it?

like image 663
Muhsin Keloth Avatar asked Oct 23 '15 07:10

Muhsin Keloth


3 Answers

It is working after Clearing bootstrap/cache directory.

like image 143
Muhsin Keloth Avatar answered Nov 16 '22 03:11

Muhsin Keloth


This is how its worked out for me in the case of a fresh install.

First, I cleared the files in boostrap\cache.

Then, in config\app.php, I added the below line in the providers,

 \Laravel\Telescope\TelescopeServiceProvider::class,

Then I ran the below commands

php artisan telescope:install
php artisan migrate

And it was working after this. I don't know for what reason the telescope provider didn't work which was added by Laravel itself. i.e App\Providers\TelescopeServiceProvider::class.

By the way my laravel version was 7.12.0.

like image 26
Devender Gupta Avatar answered Nov 16 '22 03:11

Devender Gupta


In my case, some extension of the VSCode, added a use Illuminate\Support\Facades\App; at the beginning of the file /config/app.php.

I solved it by removing the line from the file and running composer install.

like image 1
Hugo Rodrigues Avatar answered Nov 16 '22 03:11

Hugo Rodrigues