Reputation: 1381
I have an index.handlebars file in my views folder but I still got this error message
Error: Failed to lookup view "index" in views directory
Below is my app.js file.
var express = require('express');
var app = express();
var exphbs = require('express3-handlebars')
app.engine('handlebars', exphbs({defaultLayout: 'main'}));
app.set('view engine', 'handlebars');
app.get('/',function(req,res){
res.render('index');
});
app.use('/public', express.static('public'));
var port = Number(process.env.PORT || 3000);
app.listen(port);
Any thought? I felt so strange, it seems everything were right to me.
Upvotes: 1
Views: 1754
Reputation: 5939
I have checked out your Github repo regarding this problem.
It seems that you have mistyped the name of the view. It's currently index.handlerbars
while it should be index.handlebars
.
Upvotes: 1