我尝试了很多事情,但仍然出现此错误。
SyntaxError: Unexpected token / in <path> while compiling ejs
我已经看过多个这样的问题,但是没有成功
这是出现错误的部分:
<% include ./partials/messages %>
这是我的代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<title>404 Page not found</title>
<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i">
<link rel="stylesheet" href="assets/fonts/fontawesome-all.min.css">
</head>
<body id="page-top">
<div id="wrapper">
<div class="d-flex flex-column" id="content-wrapper">
<div id="content" style="background-color: #000000 !important;height: 100vh;">
<nav class="navbar navbar-light navbar-expand bg-white shadow-lg mb-4 topbar static-top" style="background-color: rgb(247,23,53) !important;">
<div class="container-fluid"><img class="img-fluid" src="assets/img/Logo.png" style="width: 140px;margin: 0 auto;"></div>
</nav>
<% include ./partials/messages %>
<div class="container-fluid">
<div class="text-center border rounded shadow-lg mt-5" style="background-color: #ffffff;padding: 25px;max-width: 450px;margin: 0 auto;">
<form method="post" action="auth/login">
<h1 style="color: rgb(0,0,0);"><strong>Login</strong></h1>
<div class="form-group"><label for="password" style="color: rgb(0,0,0);"><strong>ID</strong></label><input class="form-control" type="text" name="id" placeholder="Voer hier het id in." autofocus="" required="" minlength="6" maxlength="6" pattern="\d{6}"></div>
<div class="form-group"><label for="password" style="color: rgb(0,0,0);"><strong>Password</strong></label><input class="form-control" type="password" placeholder="Password" name="password" maxlength="8" required=""><div><button class="btn btn-primary" type="submit"><strong>Login</strong></button>
</form>
</div>
</div>
</div>
</div>
<a class="border rounded d-inline scroll-to-top" href="#page-top">
<i class="fas fa-angle-up"></i></a></div>
<script src="assets/js/jquery.min.js"></script>
<script src="assets/bootstrap/js/bootstrap.min.js"></script>
<script src="assets/js/chart.min.js"></script>
<script src="assets/js/bs-init.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.4.1/jquery.easing.js"></script>
<script src="assets/js/theme.js"></script>
</body>
</html>
答案 0 :(得分:0)
尝试使用以下语法:
<%- include('partials/messages'); %>