我尝试运行Node.js应用时遇到以下错误:
Starting child process with 'node ./app.js'
C:\Users\Julian\OneDrive\Documents\Websites\Node\node_modules\connect-redis\lib\connect-redis.js:33
var Store = connect.session.Store;
^
TypeError: Cannot read property 'Store' of undefined
at module.exports (C:\Users\Julian\OneDrive\Documents\Websites\Node\node_modules\connect-redis\lib\connect-redis.js:33:30)
at Object.<anonymous> (C:\Users\Julian\OneDrive\Documents\Websites\Node\app.js:9:42)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
at Module.runMain (module.js:590:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
Program node ./app.js exited with code 1
Starting child process with 'node ./app.js'
Received SIGINT, killing child process...
Parent process exiting, terminating child...
Terminate batch job (Y/N)? y
我的package.json文件如下:
{
"name": "NodeChat",
"version": "0.0.0",
"main": "app.js",
"scripts": {
"stop": "echo not implemented",
"start": "supervisor ./app.js"
},
"dependencies": {
"connect-flash": "0.1.1",
"connect-redis": "1.4.7",
"cookie-parser": "1.4.3",
"ejs": "0.8.5",
"express": "4.6.1",
"express-partials": "0.2.0",
"express-session": "1.14.2",
"redis": "0.10.1"
}
}
我认为这可能是兼容性问题,但我相信我正在运行connect-redis@1.4.7的兼容版本。我有一个Redis运行的实例。
答案 0 :(得分:0)
更新&#34; connect-redis&#34;:&#34; 1.4.7&#34;到1.5.0解决了我的问题。