'Laravel 8 - GET http://localhost:8000/css/app.css net::ERR_ABORTED 404 (Not Found)
I can't use the app.css in my application. Every time the server returns following error
GET http://localhost:8000/css/app.css net::ERR_ABORTED 404 (Not Found).
I use a blade page.
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
I tried to use php artisan serve and php -S localhost:8000 -t public and the booth didn't work.
Solution 1:[1]
try this before running your project on server make sure to compile laravel-mix
npm install
and then run
npm run dev
your facing the error because app.css not compiled yet
Solution 2:[2]
Make sure you compile your css imports properly in resources/css/app.css first. It should look something like this:
// Fonts
@import url('https://fonts.googleapis.com/css?family=Nunito');
// Bootstrap
@import 'bootstrap';
// Font Awesome
@import '@fortawesome/fontawesome-free';
Then, run this on your terminal: npm run dev. This will in turn, compile your app.css in your public/css. If you are making custom css definitions, i suggest using a custom.css and putting it in your public/css folder, and define it BELOW your app.css, like:
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
<link href="{{ asset('css/custom.css') }}" rel="stylesheet">
Assets must always be in the public folder so they can be seen by the {{asset ('') }} command.
Solution 3:[3]
Use this worked 100%
run this command
npm i vue-loader
then run
npm run dev
you will get your solution .
Solution 4:[4]
This the step for installing:
composer require laravel/ui --dev
php artisan ui bootstrap
php artisan ui bootstrap --auth
npm install
npm run dev
If you get an error at this step you can try this:
npm run prod or npm run production
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | tameemahmad shahzad |
| Solution 2 | Ivan Aldwin A. Cristobal |
| Solution 3 | Rakesh kumar Oad |
| Solution 4 | Ethan |
