简体   繁体   English

语法错误:编译 ejs 时 index.ejs 中出现意外标识符

[英]SyntaxError: Unexpected identifier in index.ejs while compiling ejs

<body>
        <header>
            <% include templates/header.ejs %>
        </header>
            <% include templates/announcement.ejs %>
        <form>
            <br><input type="text" id="myInput" onkeyup="myFunction()" placeholder="Search a fort...">
        </form><br>
        <section id="placeList">
            <div class="placeListBackground" id="placeListGet">
             <ul id="placeCells">
                <% placeData.forEach(function(placeData) { %>
                    <div class="placeContainer <%= placeData.category %>" class><a href = "https://www.roblox.com/games/<%= placeData.placeid %>/-"><img src= "<%= placeData.placeicon %>" alt="<%= placeData.placename %>" align="left" width="178" height="100"><span><%= placeData.placename %></span><p><%= placeData.clan %></p><p>Playing: <%= placeData.playing %></p><p class="sCategory"><%= placeData.category %></p></a></div>
                <% }); %>
             </ul>
            </div>
        </section>
        <br><footer>Contact us: https://discord.gg/fMb5y7T</footer>
    </body>
    <% include templates/search.ejs %>

I've checked through and tested a bunch of different tags for ejs just in-case but I do not see why this is not working.我已经检查并测试了 ejs 的一堆不同标签,以防万一,但我不明白为什么这不起作用。 It worked previously but there must be some issue I'm overlooking unless it is the fault of ejs?它以前有效,但除非是 ejs 的错,否则我必须忽略一些问题?

I think the problem is with the ejs tags.我认为问题出在 ejs 标签上。

You have wrote: <% include templates/file.ejs %>您写道: <% include templates/file.ejs %>

And should be: <%- include ("templates/file.ejs") %>并且应该是: <%- include ("templates/file.ejs") %>

At least I had same problem and solved that way, I hope is usefull.至少我遇到了同样的问题并以这种方式解决了,我希望有用。 look for more info about ejs changes: https://github.com/RyanZim/EJS-Lint查找有关 ejs 更改的更多信息: https : //github.com/RyanZim/EJS-Lint

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 语法错误:编译 ejs 时出现意外的 token.ejs - SyntaxError: Unexpected token.ejs while compiling ejs 更新 npm 包后出现“SyntaxError: Unexpected token &#39;/&#39; in...index.ejs while compiling ejs”错误 - Getting "SyntaxError: Unexpected token '/' in...index.ejs while compiling ejs" error after updating npm packages 编译 ejs 时 /location 中出现意外的标识符 - Unexpected identifier in /location while compiling ejs 在 for 循环中编译 ejs 时出现意外标识符 - Unexpected identifier while compiling ejs in for loop SyntaxError:编译 ejs 时 C:\Users\Ak\Desktop\todolist-v1\views\list.ejs 中出现意外标识符 - SyntaxError: Unexpected identifier in C:\Users\Ak\Desktop\todolist-v1\views\list.ejs while compiling ejs Node.js:SyntaxError:意外令牌:编译ejs时 - Node.js: SyntaxError: Unexpected token : while compiling ejs SyntaxError: 意外的标记 ';' 在<file path>在编译 ejs 时</file> - SyntaxError: Unexpected token ';' in <file path> while compiling ejs 语法错误:意外标记 || 在 /var/www/html/views/components/show.ejs 中编译 ejs - SyntaxError: Unexpected token || in /var/www/html/views/components/show.ejs while compiling ejs SyntaxError: 编译 ejs 时出现意外标记“/”,但如果我删除 &lt;% include ./src/myTemplate.ejs%&gt; 有效 - SyntaxError: Unexpected token '/' while compiling ejs but works if I remove <% include ./src/myTemplate.ejs%> EJS 标签给我 SyntaxError: Unexpected identifier - EJS tags giving me SyntaxError: Unexpected identifier
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM