当前位置: 代码迷 >> 综合 >> SyntaxError: Unexpected identifier If the above error is not helpful, you may want to try EJS-Lint
  详细解决方案

SyntaxError: Unexpected identifier If the above error is not helpful, you may want to try EJS-Lint

热度:81   发布时间:2024-01-10 02:48:59.0

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)

  相关解决方案