收到ERR_INVALID_HTTP_RESPONSE错误laravel5本地主机 [英] Getting ERR_INVALID_HTTP_RESPONSE error laravel5 localhost

查看:797
本文介绍了收到ERR_INVALID_HTTP_RESPONSE错误laravel5本地主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在 Google Chrome 上的本地主机上启动 laravel 5 项目时,我陷入了困境.我正在使用此仓库中的引导管理面板: https://github.com/start-laravel/sb-admin-laravel-5

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

我安装了所有需求,例如 npm bower gulp .我清除了缓存,然后运行 php artisan serve

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

当我导航到 localhost:8000 时,页面可以正常加载,但是不会加载styles.css和frontend.js.

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

我遇到以下错误:

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

我尝试了以下操作:

  • 清除缓存的laravel
  • 清除缓存浏览器
  • 禁用Chrome扩展程序
  • 隐身
  • 创建新文件,复制css和js并将其放入新文件中
  • 在整个互联网上搜索了一个解决方案,但我没有找到..

我的代码

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

但是

当我使用XAMPP运行项目时(网址为: http://localhost/website-monitor/public /)都可以正常工作.. ::/唯一的事情是,我正在运行该网站,只是为了到达路径而未使用工匠.

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

推荐答案

尝试在项目的项目中使用 php -S localhost:8000 -t public 代替 php artisan serve 主目录.对我来说就像魅力一样!

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!

这篇关于收到ERR_INVALID_HTTP_RESPONSE错误laravel5本地主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆