Javascript sessionStore影响标头-错误[ERR_HTTP_headers_SENT]:将标头发送到客户端后无法设置标头

Javascript sessionStore影响标头-错误[ERR_HTTP_headers_SENT]:将标头发送到客户端后无法设置标头,javascript,mysql,node.js,postgresql,express,Javascript,Mysql,Node.js,Postgresql,Express,我有此代码并得到此错误: 此错误仅在我将“store:sessionStore”添加到此行“router.use(会话({secret:'iloveel89',store:sessionStore,resave:true,saveUninitialized:true,logged:false,cookie:{maxAge:7200000}])时显示 简单地添加会话存储不应影响我的头。。不知道为什么我会看到这种行为。到目前为止,我已经尝试将resave设置为false/true,并尝试使用psq

我有此代码并得到此错误:

此错误仅在我将“store:sessionStore”添加到此行“router.use(会话({secret:'iloveel89',store:sessionStore,resave:true,saveUninitialized:true,logged:false,cookie:{maxAge:7200000}])时显示

简单地添加会话存储不应影响我的头。。不知道为什么我会看到这种行为。到目前为止,我已经尝试将
resave
设置为false/true,并尝试使用psql/mysql来存储我的会话。似乎没有什么能消除这个错误

GET/api/notes 304 11.571 ms--GET/api/password/304 9.699 ms-- 错误[ERR\u HTTP\u HEADERS\u SENT]:发送后无法设置头 给客户 在validateHeader(_http_outgoing.js:500:11) 在ServerResponse.setHeader(_http_outgoing.js:507:3) 位于ServerResponse.header(/home/el8le/workspace/notes/node_modules/express/lib/response.js:767:10) 位于ServerResponse.contentType(/home/el8le/workspace/notes/node_modules/express/lib/response.js:595:15) 在ServerResponse.send(/home/el8le/workspace/notes/node_modules/express/lib/response.js:145:14) 完成时(/home/el8le/workspace/notes/node_modules/express/lib/response.js:1004:10) 位于Object.exports.renderFile(/home/el8le/workspace/notes/node_modules/jade/lib/index.js:374:12) at View.exports.u express[as engine](/home/el8le/workspace/notes/node_modules/jade/lib/index.js:417:11) 在View.render(/home/el8le/workspace/notes/node_modules/express/lib/View.js:135:8) 在tryRender(/home/el8le/workspace/notes/node_modules/express/lib/application.js:640:10) 位于Function.render(/home/el8le/workspace/notes/node_modules/express/lib/application.js:592:3) 在ServerResponse.render(/home/el8le/workspace/notes/node_modules/express/lib/response.js:1008:7) at/home/el8le/workspace/notes/app.js:40:7 在Layer.handle_错误(/home/el8le/workspace/notes/node_modules/express/lib/router/Layer.js:71:5) 在trim_前缀处(/home/el8le/workspace/notes/node_modules/express/lib/router/index.js:315:13) at/home/el8le/workspace/notes/node_modules/express/lib/router/index.js:284:7


你能分享你的/api/password/handler吗?当你调用res.send后试图访问任何res.XXXX方法时,这个错误就会出现。在
routes/password.js
中检查您的res.send calls,然后查看是否有任何东西在调用res.XXXX。