Connect-mongo在常量错误中更新结果:TypeError:无法读取未定义的属性“Store”

时间:2014-03-06 00:28:13

标签: javascript node.js mongodb express mongoose

我今天升级了connect-mongo npm,由于此错误,我的应用程序一直在崩溃。任何人都可以建议一种方法来解决这个问题吗?

错误:

/Users/ac360/Desktop/node/application/node_modules/connect-mongo/lib/connect-mongo.js:30
  var Store = connect.session.Store;
                             ^
TypeError: Cannot read property 'Store' of undefined

以下是我如何设置Connect-Mongo

//express/mongo session storage
        app.use(express.session({
            secret: 'MEAN',
            store: new mongoStore({
                url: config.db,
                collection: 'sessions'
            })
        }));

1 个答案:

答案 0 :(得分:2)

经过几个小时的搜索,这对我有用: https://github.com/mrzepinski/connect-mongo/commit/21359889c4c5b81db85183a7e0549500160cedf2

使用:

"connect-mongo": "^0.4.0",
"express": "^4.1.0",
"express-session": "^1.0.2",
"mongoose": "^3.8.8"