Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

curtsheller's avatar

'php artisan package:discover --ansi' failing. In app.php line 23: Class "App\Providers\AppServiceProvider" not found

All of a sudden, getting this on forge with a deployment. Can't figure it out.

I post to the forge, but they are usually pretty slow getting back to message.

Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

In app.php line 23:
                                                      
  Class "App\Providers\AppServiceProvider" not found  

Didn't touch app.php or the "App\Providers\AppServiceProvider" . Working locally.

Any clues? DOA until I figure this out.

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

0 likes
1 reply
Braunson's avatar

Try clearing composer's autoload cache and regenerating it by calling composer dump-autoload -o.

Alternatively clear all Laravel caches:

php artisan cache:clear
php artisan config:clear
php artisan route:clear
php artisan view:clear
composer dump-autoload -o

Next confirm the file exists (on Forge) and it's registered in your providers.

Please or to participate in this conversation.