,

Could not scan for classes inside “database/seeds” which does not appear to be a file nor a folder

Posted by

Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Error:

In ClassMapGenerator.php line 131:
                                                                                                      
  Could not scan for classes inside "database/seeds" which does not appear to be a file nor a folder

Solution:

Check the Directory Structure: Ensure that the directory database/seeds still exists. If you’re using Laravel 8 or newer, this directory should be named database/seeders. You can fix this by either renaming the folder or by updating your autoload settings.

  • Rename database/seeds to database/seeders.
mv database/seeds database/seeders

Update Composer Autoload Settings: In case renaming doesn’t work or if you’ve already updated your folder structure, ensure that your composer.json file reflects the correct paths.

  • Open composer.json and ensure that it references database/seeders instead of database/seeds.
jsonCopy code"autoload": {
    "classmap": [
        "database/seeders"
    ]
}
  • Then, run the following command to regenerate the autoload files:
codecomposer dump-autoload

Clear Cache: Sometimes Laravel caches can cause such issues. You can try clearing Laravel’s cache to see if that helps resolve the issue:

php artisan config:clear
php artisan cache:clear

Check for Hardcoded Paths: If you’ve hardcoded the database/seeds path anywhere in your codebase, replace it with database/seeders.

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x