SyntaxError: Unexpected identifier in D:\nodejs\code\later\views\articles.ejs while compiling ejs
If the above error is not helpful, you may want to try EJS-Lint:
在windows平台上运行node报错
源代码
<% include head %>
<ul><% articles.forEach((article) => { %><li><a href="/articles/<%= article.id %>"><%= article.title %></a></li><% }) %>
</ul>
<% include foot %>
应该改成
<%- include('head') -%>
<ul><% articles.forEach((article) => { %><li><a href="/articles/<%= article.id %>"><%= article.title %></a></li><% }) %>
</ul>
<%- include('foot') -%>
node.js SyntaxError:编译ejs问题时出现意外的标识符 - 糯米PHP (nuomiphp.com)