Home > OS >  Laravel cannot find public dir
Laravel cannot find public dir

Time:02-07

I worked on a team and then clone the laravel/php codes from our repository. When I serve the laravel on localhost, it cannot find all the file inside the public directory and throw an error on the terminal:

[404]: GET /public/css/style.css - No such file or directory

Many answers to similar issues advise me to change the codes in the blade.php file. The problem is that I can't edit the blade.php because it works fine on other team members even though we have the same ubuntu, PHP, and laravel version and .env file.

What I have tried:

  • Run composer install and composer update
  • Try different browsers such as firefox and chromium-based browsers
  • Run php artisan storage:link
  • Restart apache2
  • Run npm install and npm run dev

I think there is some package or something missing.

CodePudding user response:

Have you tried?

php artisan storage:link

CodePudding user response:

You need first run

php artisan storage:link

For more details check https://laravel.com/docs/8.x/filesystem

Then you must be check your .env values. Is correctly APP_URL=

Also in your exception is strange

/public/.../...

Reason is wrong configuration. First check your .env values like

APP_URL=...
FILESYSTEM_DRIVER=public

then check config/filesystems.php

  •  Tags:  
  • Related