【发布时间】:2020-01-19 15:40:54
【问题描述】:
我不知道问题出在哪里。我试过注释掉不同的部分,甚至注释掉整个东西,但它一直给我这个错误。我确保检查我的代码是否为渲染提供了正确的模板,并且确实如此。
<!DOCTYPE html>
<%
const colors = {
background: '#24323f'
accent: '#2b435a'
}
%>
<html style='background: <%= colors.background %>'>
<body>
<div class='insideBox' style='width: 100%; height: 100%; margin: 5%; background: <%= colors.accent %>'>
<div class='headers' style='margin: 0 auto;'>
<h2>Account Invitation</h2>
</div>
</div>
</body>
</html>
[api-dev] SyntaxError: Unexpected identifier while compiling ejs
[api-dev]
[api-dev] If the above error is not helpful, you may want to try EJS-Lint:
[api-dev] https://github.com/RyanZim/EJS-Lint
[api-dev] Or, if you meant to create an async function, pass `async: true` as an option.
[api-dev] at new Function (<anonymous>)
[api-dev] at Template.compile (C:\Users\Arthur\Documents\GitHub\conference-manager\node_modules\ejs\lib\ejs.js:626:12)
[api-dev] at Object.compile (C:\Users\Arthur\Documents\GitHub\conference-manager\node_modules\ejs\lib\ejs.js:366:16)
[api-dev] at handleCache (C:\Users\Arthur\Documents\GitHub\conference-manager\node_modules\ejs\lib\ejs.js:215:18)
[api-dev] at Object.exports.render (C:\Users\Arthur\Documents\GitHub\conference-manager\node_modules\ejs\lib\ejs.js:393:10)
[api-dev] at emailUser (C:\Users\Arthur\Documents\GitHub\conference-manager\src\server\util\index.js:311:16)
[api-dev] at readFile.then (C:\Users\Arthur\Documents\GitHub\conference-manager\src\server\util\index.js:281:27)
【问题讨论】: