require('connect-mongo');注册登录Session时报错!!!!
var Store = connect.Store || connect.session.Store; ^ TypeError: Cannot read property ‘Store’ of undefined
5 回复
直接查google: var MongoStore = require(‘connect-mongo’); 这一行改成 var MongoStore = require(‘connect-mongo’)(express); 希望帮到你
我之前就是用的 var MongoStore = require(‘connect-mongo’)(express);会报下面提示错误,说是这个包不依赖express
Error: Most middleware (like session) is no longer bundled with Express and must be installed separately. Please see https://github.com/senchalabs/connect#middl eware.
求解决方案!!!
嗯 是这样的. express升到4.0+之后 移除了connect中间件 很多网上的教程是基于express 4-的 4之后这样用吧.
var session = require('express-session');
var MongoStore = require('connect-mongo')(session);
收藏之~