title: nodemailer-express-handlebars | Error: ENOENT: no such file or directory for template
body: <p>I am having an issue where nodemailer-express-handlebars is outputing the error:</p>
  <pre><code>[Error: ENOENT: no such file or directory, open ''] {
    errno: -2,
    code: 'ENOENT',
    syscall: 'open',
    path: '/Users/person/Code/app/api/controllers/templates/undefined.hbs'
  </code></pre>
  <p>My setup is as follows:</p>
  <pre><code> const handlebarOptions = {
      viewEngine: {
        extName: &quot;.hbs&quot;,
        partialsDir: path.resolve(__dirname, &quot;templates&quot;),
        defaultLayout: false
      },
      viewPath: path.resolve(__dirname, &quot;templates&quot;),
      extName: &quot;.hbs&quot;
    };
  
    transporter.use('compile', hbs(handlebarOptions));
  </code></pre>
  <p>and sending the email with:</p>
  <pre><code> let mailOptions = await transporter.sendMail({
      from: '&quot;Test - No Reply&quot; &lt;test@test.com&gt;'
      to: 'someEmail@gmail.com, 
      subject: &quot;Hello ✔&quot;,
      template: 'welcome',
    });
  </code></pre>
  <p>Oddly enough I still receive the email even though it says it cant find the file. How can I resolve this error and have nodemailer-express-handlebars not see the files as 'undefined.hbs'?</p>
  <p>UPDATE:</p>
  <p>I changed 'welcome' to 'welcome.hbs' in the nodemailer and now the error is saying it can't find 'welcome.hbs.hbs'. This makes sense, you would think the solution would be to remove the '.hbs' and make it 'welcome' but then we are back to the original error of 'undefined.hbs'.</p>
  <p>Also, if i change the template to 'welcome2' it says it cant find 'welcome2.hbs'. Its weird... it's as though it becomes undefined only when the template file matches the filename which is what it should be.</p>