Closed TidyIQ closed 5 years ago
For some reason I can't edit this post... I was trying to edit the name and description as it looks like the issue is that you can't set viewPath at all if you have a folder that contains periods in it.
In development my root folder is app/
. In production it is var/www/api.my-domain.com/
.
If I use viewPath: "/var/www/api.my-domain.com/email_templates/layouts"
or viewPath: "../api.my-domain.com/email_templates/layouts"
then I get the same error as before:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined.
at validateString (internal/validators.js:125:11)
at Object.resolve (path.js:1080:7)
at ExpressHandlebars._resolveLayoutPath (/var/www/api.my-domain.com/node_modules/express-handlebars/lib/express-handlebars.js:342:17)
at ExpressHandlebars.<anonymous> (/var/www/api.my-domain.com/node_modules/express-handlebars/lib/express-handlebars.js:223:35)
No matter what I try, I can't set the viewPath. Neither absolute or relative paths work.
I have the same problem.
Node Version: v10.15.1 NPM Version: 6.9.0
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
at assertPath (path.js:39:11)
at Object.resolve (path.js:1085:7)
at ExpressHandlebars._resolveLayoutPath (/Applications/MAMP/htdocs/numu/node-api/node_modules/express-handlebars/lib/express-handlebars.js:342:17)
at ExpressHandlebars.<anonymous> (/Applications/MAMP/htdocs/numu/node-api/node_modules/express-handlebars/lib/express-handlebars.js:223:35)
const mailgunHandlebars = {
viewEngine: handlebarsEngine,
viewPath: path.resolve(__dirname, "../views/emails/"),
extName: ".hbs"
};
logging path.resolve(__dirname, "../views/emails/")
returns /Applications/MAMP/htdocs/project_name/src/views/emails. All email templates are present in this directory
Looks like a duplicate of #26
My folder structure:
In
dist/emails.js
, I'm trying to set the viewPath toemail_templates/layout
.If I use
viewPath: "../email_templates/layouts"
then I get the error:If I use
viewPath: "/email_templates/layouts"
then I get the error:If I use
viewPath: "./email_templates/layouts"
orviewPath: "email_templates/layouts"
then I get the error:It doesn't seem possible to simply set the viewPath as a relative path to one folder up from the parent. Is that correct?