What does 'TypeError: Cannot read property '_locals' of undefined' mean?
What does 'TypeError: Cannot read property '_locals' of undefined' mean?
我在 teamTreeHouse 上做这个教程
https://teamtreehouse.com/library/express-basics/using-templates-with-express/using-jade-in-your-express-app
我收到了这个错误:
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)
现在,根据我从该域中读取的信息,我没有名为 _locals 的文件夹。
app.set('view engine', 'jade');
app.set('views', './templates');
我正在使用这些代码行来启动它。
我正在使用
app.set('views', __dirname + './templates');
但是我的 app.js 与我的模板文件夹 "LTQ"
在同一个文件夹中
为什么我会收到这个错误?
这是什么意思?
你能不能省略点,看看会发生什么。我是说这个
app.set('views', __dirname + '/templates');
我在 teamTreeHouse 上做这个教程 https://teamtreehouse.com/library/express-basics/using-templates-with-express/using-jade-in-your-express-app
我收到了这个错误:
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)
现在,根据我从该域中读取的信息,我没有名为 _locals 的文件夹。
app.set('view engine', 'jade');
app.set('views', './templates');
我正在使用这些代码行来启动它。 我正在使用
app.set('views', __dirname + './templates');
但是我的 app.js 与我的模板文件夹 "LTQ"
在同一个文件夹中为什么我会收到这个错误? 这是什么意思?
你能不能省略点,看看会发生什么。我是说这个
app.set('views', __dirname + '/templates');