我是 Sails/Node.js 的新手,所以请耐心等待 :)
我正在尝试设置 Sails 0.11.3 以通过 Passport 与 google auth 一起使用。在我尝试启用 mongo 会话存储之前,它工作得很好(谷歌身份验证工作)。
一旦我添加到 config/session.js 中:
adapter: 'mongo',
host: 'localhost',
port: 27017,
db: 'xxxx', //REAL_DB_NAME_HERE
collection: 'sessions',
帆电梯拒绝启动服务器:
$ sails lift
info: Starting app...
error: A hook (`session`) failed to load!
error: Could not load Connect session adapter :: connect-mongo
Error from adapter:
TypeError: Object function lodash(value) {
// exit early if already wrapped
if (value && value.__wrapped__) {
return value;
}
// allow invoking `lodash` without the `new` operator
if (!(this instanceof lodash)) {
return new lodash(value);
}
this.__wrapped__ = value;
} has no method 'assign'
at new MongoStore (/Users/dennis/Projects/Node.js/rubysails/node_modules/connect-mongo/lib/connect-mongo.js:114:19)
at Hook.SessionHook.initialize (/usr/local/lib/node_modules/sails/lib/hooks/session/index.js:169:37)
at Hook.bound [as initialize] (/usr/local/lib/node_modules/sails/node_modules/lodash/dist/lodash.js:729:21)
at /usr/local/lib/node_modules/sails/lib/hooks/index.js:74:14
at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:451:17
at /usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:441:17
at _each (/usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:46:13)
at Object.taskComplete (/usr/local/lib/node_modules/sails/node_modules/async/lib/async.js:440:13)
at processImmediate [as _immediateCallback] (timers.js:345:15)
Do you have the Connect session adapter installed in this project?
Try running the following command in your project's root directory:
npm install connect-mongo
(Note: Make sure the version of the Connect adapter you install is compatible with Express 3/Sails v0.10)
connect-mongo 已安装并且是最新的。
任何想法如何治愈这个?提前致谢!