Dariel Pratama
Dariel Pratama

Reputation: 1675

Laravel Sail failed to run artisan migrate

I have successfully install Laravel with Sail, the app is just fine, I can run it using sail up. however I am unable to migrate the database, everytime I run sail artisan migrate the following error thrown.

There is no existing directory at "/home/dariel/www/2021/nsmart/storage/logs" and it could not be created: Permission denied

  at vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php:172
    168▕             set_error_handler([$this, 'customErrorHandler']);
    169▕             $status = mkdir($dir, 0777, true);
    170▕             restore_error_handler();
    171▕             if (false === $status && !is_dir($dir)) {
  ➜ 172▕                 throw new \UnexpectedValueException(sprintf('There is no existing directory at "%s" and it could not be created: '.$this->errorMessage, $dir));
    173▕             }
    174▕         }
    175▕         $this->dirCreated = true;
    176▕     }

      +10 vendor frames 
  11  [internal]:0
      Illuminate\Foundation\Bootstrap\HandleExceptions::handleException()

I am stuck at this point, any help would be appreciated. thanks in advance.

Upvotes: 4

Views: 3167

Answers (2)

xpredo
xpredo

Reputation: 1513

You can try this

php artisan route:clear;
php artisan config:clear;
php artisan cache:clear;
sail artisan migrate;

Upvotes: 3

matiaslauriti
matiaslauriti

Reputation: 8082

As the error states: There is no existing directory at /home/dariel/www/2021/nsmart/storage/logs Permission denied. So you have to run mkdir /home/dariel/www/2021/nsmart/storage/logs and done...

Remember to have storage folder accesible for the process running your artisan command, it needs to use any folder inside storage.

And, if I am not wrong, sail up will give you an error, so that is why it is trying to do something in the logs folder.

Upvotes: 0

Related Questions