You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using node v12.2.0
Using express v4.17.1
Using express-handlebars v3.0.2
Using Windows 7
Documentation clearly states, that:
My code is like: let _views = ['some-path/views1'] _ex.set('views', _views)
But when I try to use an array of view paths I get an error:
TypeError [ERR_INVALID_ARG_TYPE]: The "from" argument must be of type string. Received type object
at validateString (internal/validators.js:107:11)
at Object.relative (path.js:434:5)
at ExpressHandlebars.renderView (c:\my-project\node_modules\express-handlebars\lib\express-handlebars.js:193:43)
at View.render (c:\my-project\node_modules\express\lib\view.js:135:8)
at tryRender (c:\my-project\node_modules\express\lib\application.js:640:10)
at Function.render (c:\my-project\node_modules\express\lib\application.js:592:3)
at ServerResponse.render (c:\my-project\node_modules\express\lib\response.js:1012:7)
at c:\my-project\web\views\main-default.js:6:10
at Layer.handle [as handle_request] (c:\my-project\node_modules\express\lib\router\layer.js:95:5)
at next (c:\my-project\node_modules\express\lib\router\route.js:137:13)
The text was updated successfully, but these errors were encountered:
From the stack trace, it looks like the express-handlebars library you are using is not compatible with views as array support, maybe? Since the exception is in that module and not Express.
If you think it is Express, can you provide a complete app we can run that reproduces that error stack and we can take a closer look to understand what the issue is.
I searched the express-handlebars module and indeed, this is caused because that view engine is accessing the configured views directory and doesn't support array views. There is a PR in that repo to add the array support: ericf/express-handlebars#209
Using node v12.2.0
Using express v4.17.1
Using express-handlebars v3.0.2
Using Windows 7
Documentation clearly states, that:
My code is like:
let _views = ['some-path/views1']
_ex.set('views', _views)
But when I try to use an array of view paths I get an error:
The text was updated successfully, but these errors were encountered: