我的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
这是我的代码
enter image description here 在此处输入图片说明 enter image description here
enter image description here 有人可以解决这个问题吗?
答案 0 :(得分:0)
在您用于landing.ejs
的代码中替换:
<%- include ./partials/header %>
与此:
<%- include ('./partials/header') %>
并对页脚进行相同操作。