Muhsin Keloth
Muhsin Keloth

Reputation: 7964

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?

Upvotes: 8

Views: 31010

Answers (6)

Hugo Rodrigues
Hugo Rodrigues

Reputation: 33

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.

Upvotes: 2

Ruba Adel
Ruba Adel

Reputation: 1

I had the same issue, I solved it by,

migrate migration file - vendor>laravel>telescope>database>- manually. check app.php file, if App\Providers\TelescopeServiceProvider::class, exist or not, have to exist Run in command shell>

npm run dev

Upvotes: 0

Devender Gupta
Devender Gupta

Reputation: 546

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.

Upvotes: 4

janvier
janvier

Reputation: 1

I had a question like yours then I solved it by copying app/providers directory from another Laravel project to my project thus it worked

Upvotes: 0

C Williams
C Williams

Reputation: 859

You might have deleted the folder called providers App/providers.

enter image description here

Upvotes: 0

Muhsin Keloth
Muhsin Keloth

Reputation: 7964

It is working after Clearing bootstrap/cache directory.

Upvotes: 30

Related Questions