Did you try
php artisan cache:clear
php artisan config:clear
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I removed the package superbalist/laravel-google-cloud-storagefrom from my application using
composer remove superbalist/laravel-google-cloud-storage
as I want to replace it with the Spatie package (Laravel 9 support). Currently my application is Laravel 8 but want to upgrade to Laravel 9.
I also ran composer update and composer dump-autoload.
After removing this package, I run php artisan optimize and it works fine. However I use different env variables for production and when I run php artisan optimize --env=production It gives the following error:
Error
Class "Superbalist\LaravelGoogleCloudStorage\GoogleCloudStorageServiceProvider" not found
at C:\GCPProjects\glybrary-laravel\vendor\laravel\framework\src\Illuminate\Foundation\Application.php:745
741▕ * @return \Illuminate\Support\ServiceProvider
742▕ */
743▕ public function resolveProvider($provider)
744▕ {
➜ 745▕ return new $provider($this);
746▕ }
747▕
748▕ /**
749▕ * Mark the given provider as registered.
Here is the log
[2022-06-23 20:43:50] laravel.ERROR: Class "Superbalist\LaravelGoogleCloudStorage\GoogleCloudStorageServiceProvider" not found {"exception":"[object] (Error(code: 0): Class \"Superbalist\LaravelGoogleCloudStorage\GoogleCloudStorageServiceProvider\" not found at C:\projects\example\\vendor\laravel\framework\src\Illuminate\Foundation\Application.php:745)
[stacktrace]
#0 C:\projects\example\\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(679): Illuminate\Foundation\Application->resolveProvider('Superbalist\\Lar...')
#1 C:\projects\example\\vendor\laravel\framework\src\Illuminate\Foundation\ProviderRepository.php(75): Illuminate\Foundation\Application->register('Superbalist\\Lar...')
#2 C:\projects\example\\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(659): Illuminate\Foundation\ProviderRepository->load(Array)
#3 C:\projects\example\\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\RegisterProviders.php(17): Illuminate\Foundation\Application->registerConfiguredProviders()
#4 C:\projects\example\\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(237): Illuminate\Foundation\Bootstrap\RegisterProviders->bootstrap(Object(Illuminate\Foundation\Application))
#5 C:\projects\example\\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(310): Illuminate\Foundation\Application->bootstrapWith(Array)
#6 C:\projects\example\\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php(127): Illuminate\Foundation\Console\Kernel->bootstrap()
#7 C:\projects\example\\artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 {main}
"}
What I have tried so far:
bootstrap\cache directoryconfig\app.php
composer update
composer clear-cache
php artisan cache:clear and php artisan config:clear
Also weirdly this error comes only when using the production .env file.
Please or to participate in this conversation.