我正在尝试从他在 Udemy 上的 Web Dev Bootcamp 构建类似于 Colt Steele 的 YelpCamp 项目的东西。我的项目一直进行到课程结束时使用提供的 YouTube 材料进行重构。我收到以下错误消息,试图显示数据库中的任何内容:
SyntaxError: Unexpected token || in /var/www/html/views/components/show.ejs while compiling ejs
If the above error is not helpful, you may want to try EJS-Lint:
https://github.com/RyanZim/EJS-Lint
Or, if you meant to create an async function, pass `async: true` as an option.
at new Function (<anonymous>)
at Template.compile (/var/www/html/node_modules/ejs/lib/ejs.js:626:12)
at Object.compile (/var/www/html/node_modules/ejs/lib/ejs.js:366:16)
at handleCache (/var/www/html/node_modules/ejs/lib/ejs.js:215:18)
at tryHandleCache (/var/www/html/node_modules/ejs/lib/ejs.js:254:16)
at View.exports.renderFile [as engine] (/var/www/html/node_modules/ejs/lib/ejs.js:459:10)
at View.render (/var/www/html/node_modules/express/lib/view.js:135:8)
at tryRender (/var/www/html/node_modules/express/lib/application.js:640:10)
at Function.render (/var/www/html/node_modules/express/lib/application.js:592:3)
at ServerResponse.render (/var/www/html/node_modules/express/lib/response.js:1012:7)
at /var/www/html/routes/components.js:84:17
at /var/www/html/node_modules/mongoose/lib/model.js:4834:16
at /var/www/html/node_modules/mongoose/lib/helpers/promiseOrCallback.js:24:16
at /var/www/html/node_modules/mongoose/lib/model.js:4857:21
at _hooks.execPost (/var/www/html/node_modules/mongoose/lib/query.js:4366:11)
at /var/www/html/node_modules/kareem/index.js:135:16
我的 /components/show(基本上是 campgrounds/show)代码如下所示:
<%- include ("../partials/header") %>
<title><%=component.name%></title>
<%- include ("../partials/nav") %>
<div class="row">
<div class="col-md-3">
<p class="lead">PC Part Inventory</p>
<div class="list-group">
<li class="list-group-item active">Info 1</li>
<li class="list-group-item">Info 2</li>
<li class="list-group-item">Info 3</li>
</div>
</div>
明月笑刀无情
相关分类