TypeError: Arguments to path.resolve must be strings express
tssm opened this issue · comments
I started to use Whiskers as the Express 4.x template engine and it works almost perfect. If I use .whiskers
as file extension for the templates instead of .html
the standard Express guide is enough to set up the engine. The only problem occurs when I pass an array instead of a string to views
application setting. Then the above TypeError occurs.
I must admit it's been forever since I used Express. Glad to hear it still mostly works! 😀
I vaguely remember the wackiness with which express handles views. Would you paste the entire error trace?
Sure:
TypeError: Arguments to path.resolve must be strings
at posix.resolve (path.js:439:13)
at View.module.exports [as engine] (/Users/tae/Documents/ExpressBoilerplate/node_modules/whiskers/lib/__express.js:11:24)
at View.render (/Users/tae/Documents/ExpressBoilerplate/node_modules/express/lib/view.js:126:8)
at tryRender (/Users/tae/Documents/ExpressBoilerplate/node_modules/express/lib/application.js:639:10)
at EventEmitter.render (/Users/tae/Documents/ExpressBoilerplate/node_modules/express/lib/application.js:591:3)
at ServerResponse.render (/Users/tae/Documents/ExpressBoilerplate/node_modules/express/lib/response.js:961:7)
at /Users/tae/Documents/ExpressBoilerplate/routers/index.js:4:11
at Layer.handle [as handle_request] (/Users/tae/Documents/ExpressBoilerplate/node_modules/express/lib/router/layer.js:95:5)
at next (/Users/tae/Documents/ExpressBoilerplate/node_modules/express/lib/router/route.js:131:13)
at Route.dispatch (/Users/tae/Documents/ExpressBoilerplate/node_modules/express/lib/router/route.js:112:3)
This happens when I use something like:
app.set('view engine', 'whiskers')
app.set('views', ['templates/pages', 'templates/modules'])
@gsf, a bit off-topic, but what do you use/prefer over Express?
Oops I guess I left this hanging. I don't do a lot of Node.js these days, but when I do, I just rely on the standard library.
Please comment if this is still an issue. Even better, drop a pull request!