一 . 第一个bug
报错:(很大的原因是静态页面使用时候路径出现错误一般为小圆点点的不够)
`index:1 Refused to apply style from 'http://localhost:8080/admin/fonts/iconfont.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.`
1. 分类:属于浏览器报错误(chrome和firefox都会有)
2. 解决方案1:
<link rel="stylesheet" href="../../../Static/css/common/common.css" media="all">
//删除rel属性或者删除rel和media属性都可以,改为如下: <link href="../../../Static/css/common/common.css" media="all"> <link href="../../../Static/css/common/common.css">
解决方案2:(大概率是路径错误尤其是在静态页面中)
该报错也有可能是css引入路径错误 ,这里可以使用绝对路径或者认真看好相 对路径
二. 第二个bug
报错:一般为路径找不到 或者是引入文件的时候没有加入 type="text/javascript"
Failed to load resource: the server responded with a status of 404 (Not Found)
解决方案:
一般为路径错误找不到路径这里面会出现node.js中router.get渲染不到页面中导致报错,写对路径即可同时加入type="text/javascript"
三.第三个bug(不报错问题同时也返不回值)
1.报错的问题:当浏览器发送请求成功但路由却返回err.message的值页面显示为数据err返回的值(你可以确定数据库中没有你输入的该值)
解决方案
响应页面的书写格式有问题而js中一些默认的格式故没有报错,应该规范书写方式
2.报错问题:未发生报错现象但是却返不回去值
function start() { const server = http.createServer((req, res)=>{ const pathname = url.parse(req.url).pathname; // console.log(pathname); // route.route(res,pathname) try{ // console.log(Router, pathname); Router[pathname](res); }catch(e){ Router["/404"](res); } res.end(); //这里面出现了俩次res.end()属于事件加塞 });
解决方案:
在使用express框架中把res.end()封装在函数内而在使用二级路由是调用start()函数的同时因为没有引入中间件的概念使其一个路由中出现了俩次end()导致加塞;
四.bug
报错问题:
Uncaught SyntaxError: Invalid or unexpected token
解决方案
该报错为捕获的查询无效或意外的标记,寻找语法出错标记即可