express-handlebars isn't finding my layouts or partials
<p>I have the following Express 4 view engine setup:</p>

<pre><code>var handlebars = require('express-handlebars').create({
  layoutsDir: path.join(__dirname, "views/layouts"),
  partialsDir: path.join(__dirname, "views/partials"),
  defaultLayout: 'layout',
  extname: 'hbs'
});

app.engine('handlebars', handlebars.engine);
app.set('view engine', 'hbs');
app.set('views', path.join(__dirname, "views"));
</code></pre>

<p>I have the following file structure:</p>

<pre><code>/views
    error.hbs
    index.hbs
    /partials
        menu.hbs
    /layouts
        layout.hbs
</code></pre>

<p>And finally in my route: <code>res.render('index');</code></p>

<p>And visiting my site, it loads only my <code>index.hbs</code> template. It does not use my <code>layout.hbs</code>. I don't get any errors or anything. It just doesn't use the layout even though <code>layout</code> is set as my default layout in the handlebars config.</p>

<p>Next I tried to change my code to this:</p>

<p><code>res.render('index', {layout: 'layout'});</code></p>

<p>Now I get the error:</p>

<p><code>Error: ENOENT: no such file or directory, open '/.../views/layout.hbs'</code></p>

<p>So it's like it's not finding my <code>layoutsDir</code>... What am I missing here?</p>

<p>Next I changed it to this:</p>

<p><code>res.render('index', {layout: 'layouts/layout'});</code></p>

<p>Okay so that worked. My layout is now loaded. But then I added in a partial to my layout:</p>

<p><code>{{&gt; menu }}</code></p>

<p>Now I get: <code>/.../views/index.hbs: The partial menu could not be found</code></p>

<p>So what is going on here? How come Handlebars isn't recognizing my <code>layoutsDir</code> or <code>partialsDir</code>? It's just not seeing them at all or something. And how come <code>defaultLayout</code> wasn't being used? I had to specify the layout.</p>