安装完,node app.js,访问loalhost:3000时 出现这个错误: Connect 500 TypeError: Cannot read property ‘user’ of undefined。 会不会是因为mongo的版本问题。 请教各位怎么解决?谢谢!
看具体报错位置
@Hi-Rube 错误提示是这样的 Started 2016-11-27T01:35:07.263Z GET / ::1 TypeError: Cannot read property ‘user’ of undefined at exports.authUser (/Users/sundl/bbs/middlewares/auth.js:94:18) at Layer.handle [as handle_request] (/Users/sundl/bbs/node_modules/express/lib/router/layer.js:95:5) at trim_prefix (/Users/sundl/bbs/node_modules/express/lib/router/index.js:312:13) at /Users/sundl/bbs/node_modules/express/lib/router/index.js:280:7 at Function.process_params (/Users/sundl/bbs/node_modules/express/lib/router/index.js:330:12) at next (/Users/sundl/bbs/node_modules/express/lib/router/index.js:271:10) at initialize (/Users/sundl/bbs/node_modules/passport/lib/middleware/initialize.js:53:5) at Layer.handle [as handle_request] (/Users/sundl/bbs/node_modules/express/lib/router/layer.js:95:5) at trim_prefix (/Users/sundl/bbs/node_modules/express/lib/router/index.js:312:13) at /Users/sundl/bbs/node_modules/express/lib/router/index.js:280:7 at Function.process_params (/Users/sundl/bbs/node_modules/express/lib/router/index.js:330:12) at next (/Users/sundl/bbs/node_modules/express/lib/router/index.js:271:10) at session (/Users/sundl/bbs/node_modules/express-session/index.js:159:61) at Layer.handle [as handle_request] (/Users/sundl/bbs/node_modules/express/lib/router/layer.js:95:5)
@bainana 页面能正常打开?
随手看了一眼这个位置读的是session,是不是配置里session相关的有问题啊