0
Docker 18.09.2
Mysql 5.7
Laravel 5.7
PHP 7.125

I am new at Laravel and I have a problem When I use php artisan db:seed, this error appeared:

include(/var/www/laravel_app/vendor/composer/../../database/seeds/AdminsTableSeeder.php): failed to open stream: No such file or directory

at /var/www/laravel_app/vendor/composer/ClassLoader.php:444
    440|  * Prevents access to $this/self from included files.
    441|  */
    442| function includeFile($file)
    443| {
  > 444|     include $file;
    445| }
    446|

I have no idea why does it happens. There was no error when I used php artisan migrate.

I have already tried php artisan migrate --seed and php artisan migrate:refresh --seed. Can anyone please help me?

Udhav Sarvaiya
  • 9,380
  • 13
  • 53
  • 64
pop
  • 69
  • 1
  • 1
  • 8

1 Answers1

1

You should try using composer dump-autoload.

From this answer in SO:

Basically, because Composer can't see the migration files you are creating, you are having to run the dump-autoload command which won't download anything new, but looks for all of the classes it needs to include again. It just regenerates the list of all classes that need to be included in the project (autoload_classmap.php), and this is why your migration is working after you run that command.

Bruno Francisco
  • 3,841
  • 4
  • 31
  • 61
  • Thank you for answering. I tried composer dump-autoload but an error appears. `bash: composer: command not found` I guess it is because I am building a Laravel project on docker. Is there a way to be able to use composer command in docker? – pop Mar 19 '19 at 03:04
  • hey @pop I have seen that you marked my answer as the accepted one and would like to know what changed from the last time you tried to run the command. Would be awesome to leave a comment to help out future readers – Bruno Francisco Mar 22 '19 at 10:54
  • I thought I have to run `composer dump-autoload` in my docker-container but it was wrong. I just tried to use the command in my local environment then it worked. And also I seemed to have another solution that I install `composer` in my docker-container. – pop Mar 25 '19 at 09:33