Closed vikicoder007 closed 6 years ago
This version of EJS is no longer maintained. The current version is here: https://github.com/mde/ejs
- VS Code
- Left Side File Explorer
- Right Click on the '.ejs' file
- Click on 'Copy Path'
- Then paste that path
<%- include('YOUR_PATH/GOES_HERE') %>
In my Case, OS Ubuntu, Path was like this
<%- include('/media/username/diskname/foldername/nodejsApp/views/body/header.ejs') %>
How can i solve this ejs templet
{ "message": "/Users/muluneh/Web_Chat_app/webChatApp/views/index.ejs:1\n >> 1| <%- include ('./partials/header.ejs') %>\n 2| \n 3| <div id=\"login-container\">\n 4| <div id=\"left-column\"></div>\n\n/Users/muluneh/Web_Chat_app/webChatApp/views/partials/header.ejs:16\n 14| <body>\n 15| <div class=\"menu\">\n >> 16| <% if (loggedInUser && loggedInUser.username) { %>\n 17| <div class=\"menu-item\"><a href=\"/inbox\">Inbox</a></div>\n 18| <div class=\"menu-item\"><a href=\"/users\">Users</a></div>\n 19| <div class=\"menu-item\"><a href=\"#\" onclick=\"logout()\">Logout</a></div>\n\nloggedInUser is not defined" }
这是来自QQ邮箱的假期自动回复邮件。您好,我暂时无法亲自回复您的邮件。我看到邮件后,尽快给您回复。
https://github.com/mde/ejs Which language is it
Error on Console :
Error: Could not find include include file. at getIncludePath (/home/cabox/workspace/node_modules/ejs/lib/ejs.js:152:13) at includeSource (/home/cabox/workspace/node_modules/ejs/lib/ejs.js:276:17) at /home/cabox/workspace/node_modules/ejs/lib/ejs.js:629:26 at Array.forEach ()
at Template.generateSource (/home/cabox/workspace/node_modules/ejs/lib/ejs.js:605:15)
at Template.compile (/home/cabox/workspace/node_modules/ejs/lib/ejs.js:509:12)
at Object.compile (/home/cabox/workspace/node_modules/ejs/lib/ejs.js:358:16)
at handleCache (/home/cabox/workspace/node_modules/ejs/lib/ejs.js:201:18)
at Object.exports.render (/home/cabox/workspace/node_modules/ejs/lib/ejs.js:384:10)
at Object.home (/home/cabox/workspace/app/includes/pages.js:18:16)
MY Code:
var viewCode = fs.readFileSync("./app/pages/home.ejs", 'utf-8'); Above file includes a navbar.ejs file which path is ./app/pages/inc/navbar.ejs
Code in home.ejs is <% include ./app/pages/inc/navbar.ejs %>
i got error on this so i change it to below path
<% include inc/navbar.ejs %>
again i got same error
how to resolve this ?