使用布局时,Jade Template Engine错误

我正在做一个应用程序,其中的侧边栏导航停留在所有页面上。 而不是复制内容,我想在布局文件中进行导航,并在其他的玉文件中使用它。

这是layout.pug文件:

html head meta(charset='utf-8') link(rel='stylesheet', href='/stylesheets/style.css') link(rel='stylesheet', href='/stylesheets/bootstrap.min.css') title= title body #wrapper #sidebar-wrapper ul.sidebar-nav li.sidebar-brand a(href="#") LMS li a(href="#") Dashboard li a(href="#") Search li a(href="#") Issue block dashboard 

这是我的index.pug文件:

 extends layout block dashboard p Welcome to express 

路由器文件是标准的,并呈现索引文件。 但是,当我尝试加载浏览器中的应用程序,我得到这个错误。

 GET / 500 241.336 ms - 1178 Error: C:\Users\Faisal\Desktop\LMS\views\error.pug:3 Unexpected block content at makeError (C:\Users\Faisal\Desktop\LMS\node_modules\pug-error\index.js:32:13) at error (C:\Users\Faisal\Desktop\LMS\node_modules\pug-linker\index.js:7:30) at C:\Users\Faisal\Desktop\LMS\node_modules\pug-linker\index.js:47:9 at Array.forEach (<anonymous>) at link (C:\Users\Faisal\Desktop\LMS\node_modules\pug-linker\index.js:45:20) at compileBody (C:\Users\Faisal\Desktop\LMS\node_modules\pug\lib\index.js:171:9) at Object.exports.compile (C:\Users\Faisal\Desktop\LMS\node_modules\pug\lib\index.js:243:16) at handleTemplateCache (C:\Users\Faisal\Desktop\LMS\node_modules\pug\lib\index.js:216:25) at Object.exports.renderFile (C:\Users\Faisal\Desktop\LMS\node_modules\pug\lib\index.js:428:10) at Object.exports.renderFile (C:\Users\Faisal\Desktop\LMS\node_modules\pug\lib\index.js:418:21) 

这个错误代码是非常模糊的,我不知道我的代码有什么问题。

编辑1:这里是error.pug

 extends layout block content h1= message h2= error.status pre #{error.stack} 

这里发生的事情是你的路由抛出一个错误,然后你的错误页面在尝试渲染时也抛出一个错误。 更改error.pug第2行以读取

 block dashboard 

代替

 block content 

并会显示实际的错误