SyntaxError:编译ejs时出现意外的token.ejs

问题描述 投票:-1回答:1

我的ejs文件路径不起作用。

SyntaxError:出现意外的令牌'/'C:\ Users \ mikda \ Desktop \ ColtFULL \ Section33 \ YelpCamp \ v3 \ views \ landing.ejs在编译ejs时

如果上述错误没有帮助,您可以尝试使用EJS-Lint:https://github.com/RyanZim/EJS-Lint或者,如果您要创建一个异步功能,将async: true作为选项传递。在新功能()在Template.compile(C:\ Users \ mikda \ Desktop \ ColtFULL \ Section33 \ YelpCamp \ v3 \ node_modules \ ejs \ lib \ ejs.js:626:12)在Object.compile(C:\ Users \ mikda \ Desktop \ ColtFULL \ Section33 \ YelpCamp \ v3 \ node_modules \ ejs \ lib \ ejs.js:366:16)在handleCache(C:\ Users \ mikda \ Desktop \ ColtFULL \ Section33 \ YelpCamp \ v3 \ node_modules \ ejs \ lib \ ejs.js:215:18)在tryHandleCache(C:\ Users \ mikda \ Desktop \ ColtFULL \ Section33 \ YelpCamp \ v3 \ node_modules \ ejs \ lib \ ejs.js:254:16)在View.exports.renderFile [作为引擎]处(C:\ Users \ mikda \ Desktop \ ColtFULL \ Section33 \ YelpCamp \ v3 \ node_modules \ ejs \ lib \ ejs.js:459:10)在View.render(C:\ Users \ mikda \ Desktop \ ColtFULL \ Section33 \ YelpCamp \ v3 \ node_modules \ express \ lib \ view.js:135:8)在tryRender(C:\ Users \ mikda \ Desktop \ ColtFULL \ Section33 \ YelpCamp \ v3 \ node_modules \ express \ lib \ application.js:640:10)在Function.render(C:\ Users \ mikda \ Desktop \ ColtFULL \ Section33 \ YelpCamp \ v3 \ node_modules \ express \ lib \ application.js:592:3)在ServerResponse.render(C:\ Users \ mikda \ Desktop \ ColtFULL \ Section33 \ YelpCamp \ v3 \ node_modules \ express \ lib \ response.js:1012:7)在C:\ Users \ mikda \ Desktop \ ColtFULL \ Section33 \ YelpCamp \ v3 \ app.js:43:9在Layer.handle上[作为handle_request](C:\ Users \ mikda \ Desktop \ ColtFULL \ Section33 \ YelpCamp \ v3 \ node_modules \ express \ lib \ router \ layer.js:95:5)在下一个(C:\ Users \ mikda \ Desktop \ ColtFULL \ Section33 \ YelpCamp \ v3 \ node_modules \ express \ lib \ router \ route.js:137:13)在Route.dispatch(C:\ Users \ mikda \ Desktop \ ColtFULL \ Section33 \ YelpCamp \ v3 \ node_modules \ express \ lib \ router \ route.js:112:3)在Layer.handle上[作为handle_request](C:\ Users \ mikda \ Desktop \ ColtFULL \ Section33 \ YelpCamp \ v3 \ node_modules \ express \ lib \ router \ layer.js:95:5)在C:\ Users \ mikda \ Desktop \ ColtFULL \ Section33 \ YelpCamp \ v3 \ node_modules \ express \ lib \ router \ index.js:281:22

这是我的代码

Here is my folder structure

enter image description here在此处输入图片说明enter image description here

enter image description here有人可以解决这个问题吗?

javascript node.js express ejs
1个回答
0
投票

在您的landing.ejs的代码中替换:

<%- include ./partials/header %>

带有此:

<%- include ('./partials/header') %>

并且也对页脚进行同样的操作。

© www.soinside.com 2019 - 2024. All rights reserved.