NodeJs - esc is not a function

前端 未结 3 2062
栀梦
栀梦 2021-02-14 20:55

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
             


        
3条回答
  •  南旧
    南旧 (楼主)
    2021-02-14 21:36

    As @Dash answered the question, it happens when you have an undefined variable in the .ejs template. There is a tricky way to find this variable and the way to do that is to put the template code directly in your ejs file and now when you run your app you can see which variable in undefined. For example, let's assume that you have index.ejs and in this file you included a template <%include partials/_pagination.ejs %>. Now if you encounter this error, simply copy and past the code within the _pagination file in your index and run your app to find which variable is undefined.

提交回复
热议问题