I'm doing this tutorial on teamTreeHouse https://teamtreehouse.com/library/express-basics/using-templates-with-express/using-jade-in-your-express-app
and I'm getting this error:
TypeError: Cannot read property '_locals' of undefined at EventEmitter.render (c:\Users\bcarr\Web Projects\LTQ\node_modules\express\lib\application.js:548:11) at c:\Users\bcarr\Web Projects\LTQ\app.js:12:9 at Layer.handle [as handle_request] (c:\Users\bcarr\Web Projects\LTQ\node_modules\express\lib\router\layer.js:95:5) at next (c:\Users\bcarr\Web Projects\LTQ\node_modules\express\lib\router\route.js:131:13) at Route.dispatch (c:\Users\bcarr\Web Projects\LTQ\node_modules\express\lib\router\route.js:112:3) at Layer.handle [as handle_request] (c:\Users\bcarr\Web Projects\LTQ\node_modules\express\lib\router\layer.js:95:5) at c:\Users\bcarr\Web Projects\LTQ\node_modules\express\lib\router\index.js:277:22 at Function.process_params (c:\Users\bcarr\Web Projects\LTQ\node_modules\express\lib\router\index.js:330:12) at next (c:\Users\bcarr\Web Projects\LTQ\node_modules\express\lib\router\index.js:271:10) at expressInit (c:\Users\bcarr\Web Projects\LTQ\node_modules\express\lib\middleware\init.js:33:5)
now from what I've read from this domain, I have no folder named _locals.
app.set('view engine', 'jade');
app.set('views', './templates');
I'm using these lines of code to start it. I was using
app.set('views', __dirname + './templates');
but my app.js is in the same folder as my templates folder "LTQ"
Why am I getting this error guys? What does it mean?
__dirname + './templates'
works out. Try using path (path.resolve(__dirname, 'templates')
). – JCOC611