Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting ERR_INVALID_HTTP_RESPONSE error laravel5 localhost

I'm getting stuck when I launch my laravel 5 project on localhost on Google Chrome. I'm using the bootstrap admin panel from this repo: https://github.com/start-laravel/sb-admin-laravel-5

I installed al the needs, like npm, bower and gulp. I cleared cache and then I run php artisan serve

When I navigate to localhost:8000 the page loads fine, but the styles.css and the frontend.js will not be loaded.

I'm getting the following error:

GET http://localhost:8000/assets/stylesheets/styles.css net::ERR_INVALID_HTTP_RESPONSE 
GET http://localhost:8000/assets/scripts/frontend.js net::ERR_INVALID_HTTP_RESPONSE
GET http://localhost:8000/favicon.ico net::ERR_INVALID_HTTP_RESPONSE

I've tried the following things:

  • Cleared cache laravel
  • Cleared cache browser
  • Disabled chrome extensions
  • Going incognito
  • Created new files, copied the css and js and put it in the new file
  • Searched the whole internet for a solution, which I haven't found..

My Code

<link rel="stylesheet" href="{{ asset("assets/stylesheets/styles.css") }}" />
<script src="{{ asset("assets/scripts/frontend.js") }}" type="text/javascript"></script>

But

When I run my project using XAMPP (the url then is: http://localhost/website-monitor/public/) it all works fine.. :/ the only thing is, i'm running the site just to going to the path and not using artisan..

If anyone have the solution, please let me now, i've spilled my whole day on this annoying bug

like image 910
Dennis Avatar asked Feb 03 '26 07:02

Dennis


1 Answers

Instead of php artisan serve try using php -S localhost:8000 -t public in your project's home directory. Works like a charm for me!

like image 75
MCFreddie777 Avatar answered Feb 05 '26 23:02

MCFreddie777



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!