[求助]百度bae里nodejs总是报TypeError: Cannot call method 'write' of undefined
发布于 1年前 作者 dexteryao 718 次浏览

我写的代码放到bae里每次访问都有这个错误,大家帮忙看下什么原因。困扰我好久了。

TypeError: Cannot call method 'write' of undefined
at ServerResponse.module.exports.res.end (instance1/nodejs/***.duapp.com/app/node_modules/express/node_modules/connect/lib/middleware/logger.js:151:16)
at ServerResponse.res.send (instance1/nodejs/***.duapp.com/app/node_modules/express/lib/response.js:149:8)
at module.exports (instance1/nodejs/***.duapp.com/app/routes/index.js:121:25)
at Weixin.ResponseMessage (instance1/nodejs/***.duapp.com/app/models/weixin.js:50:9)
at Parser.exports.Parser.Parser.parseString (instance1/nodejs/***.duapp.com/app/node_modules/xml2js/lib/xml2js.js:255:20)
at Parser.EventEmitter.emit (events.js:96:17)
at Object.exports.Parser.Parser.reset.saxParser.onclosetag (instance1/nodejs/***.duapp.com/app/node_modules/xml2js/lib/xml2js.js:225:24)
at emit (instance1/nodejs/***.duapp.com/app/node_modules/xml2js/node_modules/sax/lib/sax.js:602:33)
at emitNode (instance1/nodejs/***.duapp.com/app/node_modules/xml2js/node_modules/sax/lib/sax.js:607:3)
at closeTag (instance1/nodejs/***.duapp.com/app/node_modules/xml2js/node_modules/sax/lib/sax.js:848:5)
3 回复

Anyone help me?

app.use(express.logger('dev')); 去了就行了。或者改logger.js也可以,上次好像有人说过。

原因没有深究,谁知道的分享一下。

谢谢了,我把app.use(express.logger(‘dev’));删了就好了,我看有人说是bae不支持哪个方法引起的。

回到顶部