How to solve the views directory errors in hbs library for express || Two methods || Best 2021 Error

Опубликовано: 13 Май 2026
на канале: Tricky Helpers
3,241
43

In this video i will show you two different method to solve the views directory errors in hbs library for express
#hbs library #errors #expressjs
Express 4.0 Failed to Look up view in “/views” directory

Here is the configuration

app.set('views', path.join(__dirname, 'views/'));
app.engine('hbs', hbs({defaultLayout: 'main', extname: '.hbs'}));
app.set('view engine', 'hbs');
The contact.html is in the views directory

app.get('/', function(req, res) {
res.render("contact");
});
This is the error i get :

Error: Failed to lookup view "contact" in views directory "/Users/max23/