Hi,
working fine in my local dev env, I am facing problems with V8 when trying to deploy to Ubuntu servers. I tried to remove the generated config but the effect is the same...
`> @php artisan package:discover --ansi
Symfony\Component\Debug\Exception\FatalThrowableError : Class name must be a valid object or a string
at /home/forge/atl.bfd.space/vendor/spatie/laravel-medialibrary/src/MediaLibraryServiceProvider.php:23
19| $this->registerPublishables();
20|
21| $mediaClass = config('media-library.media_model');
22|
23| $mediaClass::observe(new MediaObserver());
24|
25| $this->loadViewsFrom(__DIR__.'/../resources/views', 'media-library');
26| }
27|
Exception trace:
1 Spatie\MediaLibrary\MediaLibraryServiceProvider::boot()
/home/forge/atl.bfd.space/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:32
2 call_user_func_array()
/home/forge/atl.bfd.space/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php:32
Please use the argument -v to see more details.
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1`
Any idea how to face this?
Many thanks,
Philipp
Have you cleared all caches? Including the config cache?
Hi, I tried to but all clearing commands are failing with the mentioned error :-(
Ok found the problem on my end: When installing the Media Lib 8 package I was on PHP 7.3 on this server. The update was done later. This lead to the problem that I manually had to uninstall the ML first, then reinstall. Now working out fine.
Thanks for your support, it was my fault ;-)
I have the same problem. Both local and server are running on 7.4. Works local and in github actions but gives this error on the server.
I tried removing my vendor folder on the server and doing a composer install again like @phkreis , but same problem.
Found it. It is not possible to triggerphp artisan config:clearsince the autoloading fails, but it is possible to delete bootstrap/cache/config.php . If I delete that file it works!
steps are:
php artisan config:clear
php artisan cache:clear
remove vendor folder and composer.lock
composer install and try again
If you are getting the error in deployment, delete the config in the cache, do the following;
sudo rm (YOU PROJECT PATH HERE)/bootstrap/cache/config.php
on ubuntu server
thanks @mohanad69 , it worked
Most helpful comment
Found it. It is not possible to trigger
php artisan config:clearsince the autoloading fails, but it is possible to delete bootstrap/cache/config.php . If I delete that file it works!