Laravel clear package auto-discovery cache of composer packages

3.9k Views Asked by At

I wanted to remove a package from laravel. I did composer remove vendor/package

It was all good on my dev, but when I deploy on production something went wrong and I cannot do anything now.

when I run

php artisan package:discover

I'm geting

In ProviderRepository.php line 208:

Class 'Laracasts\Flash\FlashServiceProvider' not found

I'm guessing I it is something to do with some kind of cache or maby config

but I cannot run this command,

php artisan config:clear

because I'm getting the same error message as above.

PS. I'm using Laravel 5.6

2

There are 2 best solutions below

0
On BEST ANSWER

I fixed my problem deleting a config file like so:

$rm bootstrap/cache/config.php

This file is basically a cache for config, if you want to have this file built for you just run a following artisan command:

$php artisan config:cache
1
On

You may need clear the autoloader files if they get jammed up as it is looking at those cached files when php artisan config:clear runs, thus creating the jam.

Remove the following files and they will rebuild: /bootstrap/cache/packages.php /bootstrap/cache/services.php