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

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.

Senior Software Development Engineer at Cotocus

Related Posts

Tuning PHP 8.3 for Apache Event MPM and PHP-FPM on Ubuntu: A Complete Step-by-Step Production Guide

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 Moving…

Read More

How We Fixed a Stubborn Laravel MeiliSearch Bulk Indexing Failure (16,000+ Records)

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 If…

Read More

Laravel Search Without Docker, Queues, or Horizon

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 Modern…

Read More

Laravel Scout with Typesense vs Meilisearch

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 Modern…

Read More

SESSION_DRIVER=file vs SESSION_DRIVER=database in Laravel

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 Which…

Read More

Laravel Logging: Complete Step-by-Step Guide to Enable, Debug, Verify, and Master Logs in Any Laravel Project

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 Logging…

Read More
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments