gpt4 book ai didi

javascript - 'TypeError: Cannot read property ' _locals' of undefined' 是什么意思?

转载 作者:行者123 更新时间:2023-11-30 16:12:37 25 4
gpt4 key购买 nike

我正在 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)

now from what I've read from this domain, I have no folder named _locals.

app.set('view engine', 'jade');
app.set('views', './templates');

我正在使用这些代码行来启动它。我在用

app.set('views', __dirname + './templates');

但我的 app.js 与我的模板文件夹“LTQ”位于同一文件夹中

为什么我会收到这个错误?什么意思?

最佳答案

你能不能省略点,看看会发生什么。我是说这个

app.set('views', __dirname + '/templates');

关于javascript - 'TypeError: Cannot read property ' _locals' of undefined' 是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36013826/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com