Failed: Trying to use handlebars in NodeJs using Expressjs

424 views
Skip to first unread message

Aman Kr Sharma

unread,
Jul 13, 2020, 9:14:15 PM7/13/20
to nodejs
I am trying to use handlerbars using expressjs to load dynamic content but I encounter this error

Error: ENOENT: no such file or directory, open '/home/aman/Documents/Coding/nodejs/expressjs2/views/layouts/main.handlebars'```  This is what I am doing ```app.engine("hbs", expressHbs());

This is what I added in my app.js  main file

app.set("view engine", "hbs"); //Using handlebar engine to load dynamic content
app.set("views", "views"); // By default location is views but you can change it to template```
Screenshot from 2020-07-14 06-09-51.png

Zlatko

unread,
Jul 22, 2020, 2:00:53 AM7/22/20
to nodejs
Hello,

It looks like a user issue, but there's not enough details to be certain.


On Tuesday, July 14, 2020 at 3:14:15 AM UTC+2, Aman Kr Sharma wrote:

Error: ENOENT: no such file or directory, open '/home/aman/Documents/Coding/nodejs/expressjs2/views/layouts/main.handlebars'```  This is what I am doing ```app.engine("hbs", expressHbs());


Does this file exist? Can you show the one including  this "main.handlebars" as well?

Zlatko
Reply all
Reply to author
Forward
0 new messages