0
我不斷收到以下錯誤:會話的NodeJS錯誤
/usr/local/lib/node/.npm/connect/1.6.0/package/lib/middleware/session.js:263
var secured = cookie.secure && (req.connection.encrypted || req.connec
^*emphasized text*
TypeError: Cannot read property 'secure' of undefined
at ServerResponse.writeHead (/usr/local/lib/node/.npm/connect/1.6.0/package/lib/middleware/session.js:263:29)
at ServerResponse._implicitHeader (http.js:763:8)
at ServerResponse.end (http.js:628:10)
at IncomingMessage.next (/usr/local/lib/node/.npm/connect/1.6.0/package/lib/http.js:163:13)
at ServerResponse.render (/usr/local/lib/node/.npm/express/2.4.3/package/lib/view.js:327:16)
at /Users/josebalius/Sites/report/report_server.js:102:10
at /Users/josebalius/Sites/report/report_server.js:23:13
at Query.<anonymous> (/usr/local/lib/node/.npm/mysql/0.9.1/package/lib/mysql/client.js:119:11)
at Query.emit (events.js:39:17)
at Query._handlePacket (/usr/local/lib/node/.npm/mysql/0.9.1/package/lib/mysql/query.js:53:14)
下面是代碼
// require express, mysql, and our very own db library
var express = require("express");
mysqlD = require("mysql").Client;
mysql = new mysqlD();
MemoryStore = require('connect').session.MemoryStore;
var app = express.createServer();
app.use(express.bodyParser());
app.use(express.cookieParser());
app.use(express.session({ secret: "hey you", store: new MemoryStore({ reapInterval: 60000 * 10 }) }));
這似乎是錯誤來自模塊的代碼,而不是你自己的。無論是模塊有錯誤,或者你不知道如何正確使用它,模塊不會正常報告。 – MooGoo