[Fix] Laravel Sail Permission Error on Windows WSL

laravel

Error message:

The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied
The exception occurred while attempting to log: The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied
The exception occurred while attempting to log: The /var/www/html/bootstrap/cache directory must be present and writable.

Cause

This issue happens sometimes on Windows when the docker VM was started from the Docker Desktop panel.

Fix

In the project folder, run:

./vendor/bin/sail up -d

Output

 ./vendor/bin/sail up -d
[+] Running 6/6
 ⠿ Container letsgo-mailhog-1       Running                                                        0.0s
 ⠿ Container letsgo-selenium-1      Running                                                        0.0s
 ⠿ Container letsgo-redis-1         Running                                                        0.0s
 ⠿ Container letsgo-mysql-1         Running                                                        0.0s
 ⠿ Container letsgo-meilisearch-1   Running                                                        0.0s
 ⠿ Container letsgo-laravel.test-1  Started

 

Other Fixes

If your issue still persists, see other solutions here: https://stackoverflow.com/questions/50552970/laravel-docker-the-stream-or-file-var-www-html-storage-logs-laravel-log-co

0 Shares:
You May Also Like