title: Failed to lookup view in directory with Express Handlebars
body: <p>I'm following the base app layout you get from Express Generator and attempting to configure it for Handlebars.</p>
  
  <p>Snippet:</p>
  
  <pre><code>var exphbs = require('express-handlebars');
  
  var app = express();
  
  // view engine setup
  app.set('views', path.join(__dirname, 'views/'));
  
  app.engine('handlebars', exphbs({defaultLayout: 'main'}));
  app.set('view engine', 'handlebars');
  </code></pre>
  
  <p>All is well until I try and change the extension for Handlebars to <code>.hbs</code> as follows:</p>
  
  <pre><code>app.engine('handlebars', exphbs({defaultLayout: 'main', extname: '.hbs'}));
  </code></pre>
  
  <p>(and rename the files of course).</p>
  
  <p>That results in:</p>
  
  <blockquote>
    <p>Error: Failed to lookup view "error" in views directory</p>
  </blockquote>
  
  <p>I've looked in <code>function ExpressHandlebars(config)</code> in express-handlebars.js source and it does attempt to set extname apppropriately.</p>
  
  <p>What am I doing wrong?</p>