DEV Community

Discussion on: How to Fix the Target Class Does Not Exist Error in Laravel

Collapse
 
doshitt profile image
doshitt

oh glad to see this, have been trying to solve same problems over 3 weeks now and yet i still get same error.. i tried this above but almost scattered the project can you assist me out on this ???

Collapse
 
abdulwahidkahar profile image
Wahid

Hi! Sorry to hear you're still stuck. Let's figure this out together.

Check Namespace: Make sure the namespace matches the folder structure.
Run composer dump-autoload: It refreshes class loading.
Verify Bindings: If you're binding in a service provider, ensure it's correct.
Confirm Injection: Check the class is properly imported and injected.
If the error persists, could you share the exact error and the related code snippet? I'll help you sort it out!

Collapse
 
igni profile image
IgniS

I also get this error when running artisan commands
Ex: 1.
composer dump-autoload
Generating optimized autoload files

Illuminate\Foundation\ComposerScripts::postAutoloadDump
@php artisan package:discover --ansi
In Container.php line 946:
Target class [cache.store] does not exist.
In Container.php line 944:
Class "cache.store" does not exist

Ex: 2.
php artisan cache:clear
In Container.php line 946:
Target class [cache.store] does not exist.

In Container.php line 944:
Class "cache.store" does not exist

Any Idea how to fix this?