美文网首页
express(三):开发中的问题

express(三):开发中的问题

作者: IMSong | 来源:发表于2017-03-16 15:11 被阅读373次

    ①: Error: Can't set headers after they are sent.
    at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:356:11)
    at ServerResponse.header (/Users/hmc/Desktop/SongsService/ReadingService/node_modules/express/lib/response.js:719:10)
    at ServerResponse.send (/Users/hmc/Desktop/SongsService/ReadingService/node_modules/express/lib/response.js:164:12)
    at done (/Users/hmc/Desktop/SongsService/ReadingService/node_modules/express/lib/response.js:956:10)
    at tryHandleCache (/Users/hmc/Desktop/SongsService/ReadingService/node_modules/ejs/lib/ejs.js:208:10)
    at View.exports.renderFile [as engine] (/Users/hmc/Desktop/SongsService/ReadingService/node_modules/ejs/lib/ejs.js:412:10)
    at View.render (/Users/hmc/Desktop/SongsService/ReadingService/node_modules/express/lib/view.js:126:8)
    at tryRender (/Users/hmc/Desktop/SongsService/ReadingService/node_modules/express/lib/application.js:639:10)
    at EventEmitter.render (/Users/hmc/Desktop/SongsService/ReadingService/node_modules/express/lib/application.js:591:3)
    at ServerResponse.render (/Users/hmc/Desktop/SongsService/ReadingService/node_modules/express/lib/response.js:960:7)
    /Users/hmc/Desktop/SongsService/ReadingService/node_modules/mysql/lib/protocol/Parser.js:79
    throw err; // Rethrow non-MySQL errors
    ^
    解决办法:return 太多

    ②: TypeError: req.next is not a function
    at done (/Users/hmc/Desktop/SongsService/ReadingService/node_modules/express/lib/response.js:955:25)
    at tryRender (/Users/hmc/Desktop/SongsService/ReadingService/node_modules/express/lib/application.js:641:5)
    at EventEmitter.render (/Users/hmc/Desktop/SongsService/ReadingService/node_modules/express/lib/application.js:591:3)
    at ServerResponse.render (/Users/hmc/Desktop/SongsService/ReadingService/node_modules/express/lib/response.js:960:7)
    at /Users/hmc/Desktop/SongsService/ReadingService/routes/index.js:73:25
    at Query._callback (/Users/hmc/Desktop/SongsService/ReadingService/db/DBDao.js:217:21)
    at Query.Sequence.end (/Users/hmc/Desktop/SongsService/ReadingService/node_modules/mysql/lib/protocol/sequences/Sequence.js:86:24)
    at Query._handleFinalResultPacket (/Users/hmc/Desktop/SongsService/ReadingService/node_modules/mysql/lib/protocol/sequences/Query.js:137:8)
    at Query.EofPacket (/Users/hmc/Desktop/SongsService/ReadingService/node_modules/mysql/lib/protocol/sequences/Query.js:121:8)
    at Protocol._parsePacket (/Users/hmc/Desktop/SongsService/ReadingService/node_modules/mysql/lib/protocol/Protocol.js:280:23)

    Process finished with exit code 1

    解决办法: 数据库没有完成就进行了 release()操作

    相关文章

      网友评论

          本文标题:express(三):开发中的问题

          本文链接:https://www.haomeiwen.com/subject/qecjnttx.html