【发布时间】:2020-12-04 05:06:14
【问题描述】:
我正在使用 ejs、node.js 和 express 以及其他包
为什么页面渲染时没有显示error.status和error.stack值?我确定这与 ejs 文件中未定义或不可访问的错误变量有关,但我不确定如何声明它或将其导入以使其可访问。 Rendered 404 page with no error.status or error.stack displaying
这是我的 error.ejs 文件
<%- include partials/header.ejs %>
<h1>404 Page Not Found</h1>
<h2><%= error.status %></h2>
<pre><%= error.stack %></pre>
<%- include partials/footer.ejs %>
这是我的 header.ejs 文件
<!DOCTYPE html>
<html lang="en">
<head>
<title> Quartile </title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" />
<link rel="stylesheet" href="/stylesheets/style.css" />
<script src="https://kit.fontawesome.com/66fd6114b0.js" crossorigin="anonymous"></script>
</head>
<body>
【问题讨论】:
标签: javascript html node.js express ejs