[GH-ISSUE #1903] [Bug]:Class "Faker\Factory" not found #1027

Closed
opened 2026-02-26 02:34:59 +03:00 by kerem · 2 comments
Owner

Originally created by @sovereignalmida on GitHub (Feb 28, 2025).
Original GitHub issue: https://github.com/koel/koel/issues/1903

Originally assigned to: @phanan on GitHub.

Read the Troubleshooting guide.

  • I have read and followed the Troubleshooting guide

Reproduction steps

1.Install Koel
2. Run koel:doctor
3. fix errors
4. ... Class Faker\Factory not found error persists

Expected behavior

No errors when running koel:doctor

Actual behavior

I have been struggling with getting koel running correctly and am now down to this last error when running koel:doctor

Class "Faker\Factory" not found

at vendor/laravel/framework/src/Illuminate/Database/DatabaseServiceProvider.php:93
89▕ $this->app->singleton(FakerGenerator::class, function ($app, $parameters) {
90▕ $locale = $parameters['locale'] ?? $app['config']->get('app.faker_locale', 'en_US');
91▕
92▕ if (! isset(static::$fakers[$locale])) {
➜ 93▕ static::$fakers[$locale] = FakerFactory::create($locale);
94▕ }
95▕
96▕ static::$fakers[$locale]->unique(true);
97▕

  +10 vendor frames 

11 app/Console/Commands/DoctorCommand.php:164
App\Models\Artist::factory()

12 app/Console/Commands/DoctorCommand.php:68
App\Console\Commands\DoctorCommand::checkServiceIntegrations()

Logs

www-data@85b72198d31e:~/html/storage/logs$ cat laravel.log
[2025-02-28 14:55:56] production.ERROR: Class "Faker\Factory" not found {"exception":"[object] (Error(code: 0): Class "Faker\Factory" not found at /var/www/html/vendor/laravel/framework/src/Illuminate/Database/DatabaseServiceProvider.php:93)
[stacktrace]
#0 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(908): Illuminate\Database\DatabaseServiceProvider->Illuminate\Database\{closure}()
#1 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(795): Illuminate\Container\Container->build()
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(957): Illuminate\Container\Container->resolve()
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(731): Illuminate\Foundation\Application->resolve()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(942): Illuminate\Container\Container->make()
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factories/Factory.php(850): Illuminate\Foundation\Application->make()
#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factories/Factory.php(153): Illuminate\Database\Eloquent\Factories\Factory->withFaker()
#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factories/Factory.php(171): Illuminate\Database\Eloquent\Factories\Factory->__construct()
#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factories/Factory.php(829): Illuminate\Database\Eloquent\Factories\Factory::new()
#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factories/HasFactory.php(16): Illuminate\Database\Eloquent\Factories\Factory::factoryForModel()
#10 /var/www/html/app/Console/Commands/DoctorCommand.php(164): App\Models\Artist::factory()
#11 /var/www/html/app/Console/Commands/DoctorCommand.php(68): App\Console\Commands\DoctorCommand->checkServiceIntegrations()
#12 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Console\Commands\DoctorCommand->handle()
#13 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#15 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#16 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\Container\BoundMethod::call()
#17 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\Container\Container->call()
#18 /var/www/html/vendor/symfony/console/Command/Command.php(326): Illuminate\Console\Command->execute()
#19 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(181): Symfony\Component\Console\Command\Command->run()
#20 /var/www/html/vendor/symfony/console/Application.php(1096): Illuminate\Console\Command->run()
#21 /var/www/html/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand()
#22 /var/www/html/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun()
#23 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(201): Symfony\Component\Console\Application->run()
#24 /var/www/html/artisan(35): Illuminate\Foundation\Console\Kernel->handle()
#25 {main}
"}

Koel version

latest

How did you install Koel?

Official Docker image

Additional information

  • Server OS: ubuntu 24.04.2 LTS
  • PHP version:PHP 8.1.8 (cli) (built: Aug 2 2022 07:31:17) (NTS)
  • Database: mariadb Ver 15.1 Distrib 10.11.11-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper
  • Node version:
  • Browser & device: Edge, Ubuntu on Surface book 2
  • Additional context:
Originally created by @sovereignalmida on GitHub (Feb 28, 2025). Original GitHub issue: https://github.com/koel/koel/issues/1903 Originally assigned to: @phanan on GitHub. ### Read the Troubleshooting guide. - [x] I have read and followed the Troubleshooting guide ### Reproduction steps 1.Install Koel 2. Run koel:doctor 3. fix errors 4. ... Class Faker\Factory not found error persists ### Expected behavior No errors when running koel:doctor ### Actual behavior I have been struggling with getting koel running correctly and am now down to this last error when running koel:doctor Class "Faker\Factory" not found at vendor/laravel/framework/src/Illuminate/Database/DatabaseServiceProvider.php:93 89▕ $this->app->singleton(FakerGenerator::class, function ($app, $parameters) { 90▕ $locale = $parameters['locale'] ?? $app['config']->get('app.faker_locale', 'en_US'); 91▕ 92▕ if (! isset(static::$fakers[$locale])) { ➜ 93▕ static::$fakers[$locale] = FakerFactory::create($locale); 94▕ } 95▕ 96▕ static::$fakers[$locale]->unique(true); 97▕ +10 vendor frames 11 app/Console/Commands/DoctorCommand.php:164 App\Models\Artist::factory() 12 app/Console/Commands/DoctorCommand.php:68 App\Console\Commands\DoctorCommand::checkServiceIntegrations() ### Logs www-data@85b72198d31e:~/html/storage/logs$ cat laravel.log [2025-02-28 14:55:56] production.ERROR: Class "Faker\Factory" not found {"exception":"[object] (Error(code: 0): Class \"Faker\\Factory\" not found at /var/www/html/vendor/laravel/framework/src/Illuminate/Database/DatabaseServiceProvider.php:93) [stacktrace] #0 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(908): Illuminate\\Database\\DatabaseServiceProvider->Illuminate\\Database\\{closure}() #1 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(795): Illuminate\\Container\\Container->build() #2 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(957): Illuminate\\Container\\Container->resolve() #3 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(731): Illuminate\\Foundation\\Application->resolve() #4 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(942): Illuminate\\Container\\Container->make() #5 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factories/Factory.php(850): Illuminate\\Foundation\\Application->make() #6 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factories/Factory.php(153): Illuminate\\Database\\Eloquent\\Factories\\Factory->withFaker() #7 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factories/Factory.php(171): Illuminate\\Database\\Eloquent\\Factories\\Factory->__construct() #8 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factories/Factory.php(829): Illuminate\\Database\\Eloquent\\Factories\\Factory::new() #9 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Factories/HasFactory.php(16): Illuminate\\Database\\Eloquent\\Factories\\Factory::factoryForModel() #10 /var/www/html/app/Console/Commands/DoctorCommand.php(164): App\\Models\\Artist::factory() #11 /var/www/html/app/Console/Commands/DoctorCommand.php(68): App\\Console\\Commands\\DoctorCommand->checkServiceIntegrations() #12 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\\Console\\Commands\\DoctorCommand->handle() #13 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}() #14 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure() #15 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod() #16 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call() #17 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\\Container\\Container->call() #18 /var/www/html/vendor/symfony/console/Command/Command.php(326): Illuminate\\Console\\Command->execute() #19 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(181): Symfony\\Component\\Console\\Command\\Command->run() #20 /var/www/html/vendor/symfony/console/Application.php(1096): Illuminate\\Console\\Command->run() #21 /var/www/html/vendor/symfony/console/Application.php(324): Symfony\\Component\\Console\\Application->doRunCommand() #22 /var/www/html/vendor/symfony/console/Application.php(175): Symfony\\Component\\Console\\Application->doRun() #23 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(201): Symfony\\Component\\Console\\Application->run() #24 /var/www/html/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle() #25 {main} "} ### Koel version latest ### How did you install Koel? Official Docker image ### Additional information - **Server OS**: ubuntu 24.04.2 LTS - **PHP version**:PHP 8.1.8 (cli) (built: Aug 2 2022 07:31:17) (NTS) - **Database**: mariadb Ver 15.1 Distrib 10.11.11-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper - **Node version**: - **Browser & device**: Edge, Ubuntu on Surface book 2 - **Additional context**:
kerem closed this issue 2026-02-26 02:34:59 +03:00
Author
Owner

@albedev commented on GitHub (May 10, 2025):

Sorry, It might be a common practice, but sometimes happens to forget it: did you run "composer install" command?

<!-- gh-comment-id:2868952801 --> @albedev commented on GitHub (May 10, 2025): Sorry, It might be a common practice, but sometimes happens to forget it: did you run "composer install" command?
Author
Owner

@phanan commented on GitHub (May 10, 2025):

@sovereignalmida Apologies, this totally fell through the cracks for me. @albedev: This is indeed a bug with the Docker build, which uses Koel's release archive, which in turn is built with --prefer-dist --no-dev Composer option. Since Faker and a couple of other packages are listed as dev dependencies, they're not included in the build. I'll issue a fix.

<!-- gh-comment-id:2868960347 --> @phanan commented on GitHub (May 10, 2025): @sovereignalmida Apologies, this totally fell through the cracks for me. @albedev: This is indeed a bug with the Docker build, which uses Koel's release archive, which in turn is built with `--prefer-dist --no-dev` Composer option. Since Faker and a couple of other packages are listed as dev dependencies, they're not included in the build. I'll issue a fix.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/koel-koel#1027
No description provided.