gpt4 book ai didi

node.js - 配对 sails、passport 和 mongo : error: A hook (`session` ) failed to load! 对象 .... 没有方法 'assign'

转载 作者:太空宇宙 更新时间:2023-11-03 23:06:17 33 4
gpt4 key购买 nike

我是 Sails/Node.js 新手,所以请耐心等待:)

我正在尝试设置 Sails 0.11.3 以通过 Passport 与 google auth 配合使用。它运行得很好(谷歌身份验证有效),直到我尝试启用 mongo session 存储。

添加到 config/session.js 后:

  adapter: 'mongo',
host: 'localhost',
port: 27017,
db: 'xxxx', //REAL_DB_NAME_HERE
collection: 'sessions',

sails lift 拒绝启动服务器:

$ 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 已安装并且是最新的。

有什么办法可以解决这个问题吗?提前致谢!

最佳答案

尝试安装connect-mongo@0.8.2

关于node.js - 配对 sails、passport 和 mongo : error: A hook (`session` ) failed to load! 对象 .... 没有方法 'assign',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34069046/

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