You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inside home.ejs I must include header.ejs. I am mercifully following their documentation: https://ejs.co/#docs and include the file this way because "Includes are relative to the template with the include call",
<%- include("header") %>
Inside ejs-template.ejs I am compiling the template like this:
Error: ejs:38
36| <body>
37|
>> 38| <%- include("header") %>
39|
40| <main class="container">
41| <h4>Some stuff</h4>
Could not find the include file "header"
at getIncludePath ([redacted]\server\node_modules\ejs\lib\ejs.js:183:13)
at includeFile ([redacted]\server\node_modules\ejs\lib\ejs.js:309:19)
at include ([redacted]\server\node_modules\ejs\lib\ejs.js:690:16)
at eval (eval at compile ([redacted]\server\node_modules\ejs\lib\ejs.js:662:12), <anonymous>:12:17)
at anonymous ([redacted]\server\node_modules\ejs\lib\ejs.js:692:17)
at module.exports ([redacted]\server\util\ejs-template.js:13:7)
at [redacted]\server\route\site.js:13:18
at Layer.handle [as handle_request] ([redacted]\server\node_modules\express\lib\router\layer.js:95:5)
at next ([redacted]\server\node_modules\express\lib\router\route.js:137:13)
at module.exports ([redacted]\server\middleware\isLoggedIn.js:8:9) {
path: ''
}
I have set the views path in the compiling options. I have tried with/without path. I've also tried with root set at the same exact views path.
What am I missing? The documentation is lax and offers no clues regarding this.
The text was updated successfully, but these errors were encountered:
You're setting the views path with path.resolve, which will resolve relative to process.cwd(), but it looks like you're setting the views path as if it'd be relative to __dirname. Try Path.resolve(__dirname, '../views').
I have my project structured like this. So simple it hurts:
Inside
home.ejs
I must includeheader.ejs
. I am mercifully following their documentation: https://ejs.co/#docs and include the file this way because "Includes are relative to the template with the include call",Inside
ejs-template.ejs
I am compiling the template like this:Yet I get this error!
I have set the views path in the compiling options. I have tried with/without path. I've also tried with
root
set at the same exact views path.What am I missing? The documentation is lax and offers no clues regarding this.
The text was updated successfully, but these errors were encountered: