I'm having trouble switching branches from the news feature to the complaints feature, but why does my Laravel always access the news module when actually the module is in another branch? What's the solution ?
I have tried to run the composer dump-autoload
command but it errors with the same message.
Error
Class "Modules\Berita\Providers\BeritaServiceProvider" not found at vendor\laravel\framework\src\Illuminate\Foundation\Application.php:935 931▕ * @return \Illuminate\Support\ServiceProvider 932▕ */ 933▕ public function resolveProvider($provider) 934▕ { ➜ 935▕ return new $provider($this); 936▕ } 937▕ 938▕ /** 939▕ * Mark the given provider as registered. 1 vendor\laravel\framework\src\Illuminate\Foundation\Application.php:867 Illuminate\Foundation\Application::resolveProvider() 2 vendor\laravel\framework\src\Illuminate\Foundation\ProviderRepository.php:75 Illuminate\Foundation\Application::register()
I have tried to run the command composer dump-autoload
, php artisan config:clear
, php artisan cache:clear
but it errors with the same message.
I'm having trouble switching branches from the news feature to the complaints feature, but why does my Laravel always access the news module when actually the module is in another branch? What's the solution ?
I have tried to run the composer dump-autoload
command but it errors with the same message.
Error
Class "Modules\Berita\Providers\BeritaServiceProvider" not found at vendor\laravel\framework\src\Illuminate\Foundation\Application.php:935 931▕ * @return \Illuminate\Support\ServiceProvider 932▕ */ 933▕ public function resolveProvider($provider) 934▕ { ➜ 935▕ return new $provider($this); 936▕ } 937▕ 938▕ /** 939▕ * Mark the given provider as registered. 1 vendor\laravel\framework\src\Illuminate\Foundation\Application.php:867 Illuminate\Foundation\Application::resolveProvider() 2 vendor\laravel\framework\src\Illuminate\Foundation\ProviderRepository.php:75 Illuminate\Foundation\Application::register()
I have tried to run the command composer dump-autoload
, php artisan config:clear
, php artisan cache:clear
but it errors with the same message.
The error happens because Laravel is still trying to load the News (Berita) module even though you've switched branches. Here's how to fix it:
Check config/app.php and remove the News provider if it's there:
// Remove this if you find it Modules\Berita\Providers\BeritaServiceProvider::class,
If you're using the Laravel-modules package, update modules_statuses.json:
Json -> { "Berita": false }
php artisan config:clear
php artisan cache:clear
php artisan route:clear
composer dump-autoload
If that doesn't work, try cleaning your Git state:
git clean -fd
git reset --hard
rm -of vendor/ rm composer.lock composer install
Hope this helps! Let me know if you need anything else
composer.json
file. Looks like you have not installed the specified package. Did you run thecomposer install
command? – Raghavendra N Commented Jan 2 at 3:46