NodeJs-esc不是函数 [英] NodeJs - esc is not a function
问题描述
尝试在此特定行呈现 .ejs 文件时遇到一个奇怪的问题
I got a weird issues when trying to render an .ejs file at this specific lines
TypeError: /home/me/nodeapp/app/views/default/page/connection.ejs:66
64| <div class="col s12 l8">
65| <ul class="collapsible popout" data-collapsible="accordion"">
>> 66| <%- include ../api_html/connection/connection_list.ejs %>
67| </ul>
68| </div>
错误
esc不是函数
esc is not a function
我真的不明白这个错误的来源。
我没有使用 esc
函数。 /api_html/connection/connection_list.ejs 文件。
I really don't understand from where this error is coming from.
I'm not using an esc
function the ../api_html/connection/connection_list.ejs
file which is included.
此外,我的本地服务器没有此问题(在Windows下),此错误是在我运行完全相同的nodeapp的CentOs服务器下引发的。
In addition to this, I'm not having this issue my local server (under Windows), this error is fired under a CentOs server where I run the exactly same nodeapp.
任何想法都会非常感谢!
Any ideas would be very appreciated !
谢谢!
推荐答案
首先感谢您的回答。
我想出了问题。
错误r在包含的EJS文件中<%-include('../api_html/connection/connection_list.ejs')%>
。
The error was in the included EJS file<%- include ('../api_html/connection/connection_list.ejs') %>
.
例如,如果包含<%,则包含../partials/header%>
包含< %= user.email%>
,它将在定义用户(用户登录)后完美运行,但会在函数中抛出 esc 并非如此。
For example, if you include <% include ../partials/header %>
that contains <%= user.email %>
, it will work perfectly when the user is defined (user is logged in) but will throw esc in not a function
when it's not.
这篇关于NodeJs-esc不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!