Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/34.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 编译ejs时出现意外标识符_Node.js_Express_Ejs - Fatal编程技术网

Node.js 编译ejs时出现意外标识符

Node.js 编译ejs时出现意外标识符,node.js,express,ejs,Node.js,Express,Ejs,编译代码时,我面临这个错误 SyntaxError: Unexpected identifier in C:\Users\LENOVO\Desktop\todo mysql\views\layout.ejs while compiling ejs If the above error is not helpful, you may want to try EJS-Lint: https://github.com/RyanZim/EJS-Lint Or, if you meant to crea

编译代码时,我面临这个错误

SyntaxError: Unexpected identifier in C:\Users\LENOVO\Desktop\todo mysql\views\layout.ejs while compiling ejs

If the above error is not helpful, you may want to try EJS-Lint:
https://github.com/RyanZim/EJS-Lint
Or, if you meant to create an async function, pass `async: true` as an option.
    at new Function (<anonymous>)
    at Template.compile (C:\Users\LENOVO\Desktop\todo mysql\node_modules\ejs\lib\ejs.js:661:12)
    at Object.compile (C:\Users\LENOVO\Desktop\todo mysql\node_modules\ejs\lib\ejs.js:396:16)
    at handleCache (C:\Users\LENOVO\Desktop\todo mysql\node_modules\ejs\lib\ejs.js:233:18)
    at tryHandleCache (C:\Users\LENOVO\Desktop\todo mysql\node_modules\ejs\lib\ejs.js:272:16)
    at View.exports.renderFile [as engine] (C:\Users\LENOVO\Desktop\todo mysql\node_modules\ejs\lib\ejs.js:489:10)
    at View.render (C:\Users\LENOVO\Desktop\todo mysql\node_modules\express\lib\view.js:135:8)
    at tryRender (C:\Users\LENOVO\Desktop\todo mysql\node_modules\express\lib\application.js:640:10)
    at Function.render (C:\Users\LENOVO\Desktop\todo mysql\node_modules\express\lib\application.js:592:3)
    at ServerResponse.render (C:\Users\LENOVO\Desktop\todo mysql\node_modules\express\lib\response.js:1012:7)
SyntaxError:编译ejs时,C:\Users\LENOVO\Desktop\todo mysql\views\layout.ejs中出现意外标识符
如果上述错误没有帮助,您可能希望尝试EJS Lint:
https://github.com/RyanZim/EJS-Lint
或者,如果要创建异步函数,请将'async:true'作为选项传递。
在新函数()处
在Template.compile(C:\Users\LENOVO\Desktop\todo mysql\node\u modules\ejs\lib\ejs.js:661:12)
在Object.compile(C:\Users\LENOVO\Desktop\todo mysql\node\u modules\ejs\lib\ejs.js:396:16)
在handleCache(C:\Users\LENOVO\Desktop\todo mysql\node\u modules\ejs\lib\ejs.js:233:18)
在tryHandleCache(C:\Users\LENOVO\Desktop\todo mysql\node\u modules\ejs\lib\ejs.js:272:16)
在View.exports.renderFile[作为引擎](C:\Users\LENOVO\Desktop\todo mysql\node\u modules\ejs\lib\ejs.js:489:10)
在View.render(C:\Users\LENOVO\Desktop\todo mysql\node\u modules\express\lib\View.js:135:8)
在tryRender(C:\Users\LENOVO\Desktop\todo mysql\node\u modules\express\lib\application.js:640:10)
在Function.render(C:\Users\LENOVO\Desktop\todo mysql\node\u modules\express\lib\application.js:592:3)
在ServerResponse.render(C:\Users\LENOVO\Desktop\todo mysql\node\u modules\express\lib\response.js:1012:7)
这是我的ejs文件,它显示了这个错误

<div id="container">
  <h1>Bing bong bing</h1>

  <%- include('components/add_todo') %> 
  <%- include('components/todo_table') %>
</div>
<!-- DIV ID Container -->

冰冰冰

您尝试了哪些调试?如果您删除了Include,它是否有效?如果是的话,问题出在哪些方面?呈现/编译模板的代码是什么样子的?