'Class UsersTableSeeders does not exist [ReflectionException]

    <?php
use Illuminate\Database\Seeder;
use App\User;

class UsersTableSeeders extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
       User::create([
                'name'=>'prakash',
                'username'=>'prakash',
                'email'=>'[email protected]',
                'password'=> bycrypt('pokhrel'),
                'remember_token'=> str_random(10),
            ]);
    }
}

I don't understand why i receiving this error : [ReflectionException] Class UsersTableSeeders does not exist



Solution 1:[1]

Make sure you add the tests directory in your composer.json like this:

"autoload": {
    "classmap": [
        "tests"
     ]
}

Run "composer dump-autoload" and "php artisan optimize" in the root of your project in terminal.

Solution 2:[2]

I was facing the very same issue. In fact it all started after adding some namespace to one of my event gateways. From the error message it looks like it was unable to find some exported utility function from the shared_utils_1. After short investigation, it turned out this is being exported as part of the "nestjs/common" package. So I looked into the package.json that is being copied as part of the build process to the docker container and noticed that the version for that particular package was different (7.0.9) than the one I used while building the app locally (8.0.0).

I updated the version (8.0.0), rebuild the app, and everything seems to be working ever since.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mardin101
Solution 2 Alexus