UnhandledPromiseRejectionWarning注册写完出现的警告

来源:8-7 注册(7)

慕哥746925

2019-05-12

i Waiting for file changes 10:56:46
(node:91292) UnhandledPromiseRejectionWarning: TypeError: middleware must be a function!
at Application.use (C:\Users\Asuka\mtmt\node_modules\koa\lib\application.js:106:41)
at _callee$ (C:/Users/Asuka/mtmt/server/index.js:56:6)
at tryCatch (C:\Users\Asuka\mtmt\node_modules@babel\runtime\node_modules\regenerator-runtime\runtime.js:45:40)
at Generator.invoke [as _invoke] (C:\Users\Asuka\mtmt\node_modules@babel\runtime\node_modules\regenerator-runtime\runtime.js:271:22)
at Generator.prototype.(anonymous function) [as next] (C:\Users\Asuka\mtmt\node_modules@babel\runtime\node_modules\regenerator-runtime\runtime.js:97:21)
at step (C:\Users\Asuka\mtmt\server\index.js:102:191)
at C:\Users\Asuka\mtmt\server\index.js:102:361
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:91292) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:91292) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

写回答

1回答

mid_one

2019-05-12

TypeError: middleware must be a function! middleware必须是个function, 错误在server/index.js里面, 仔细检查一下代码.很可能是app.use(middleware)这里出错了

0
2
mid_one
回复
慕哥746925
看报错信息, server/index.js 56行, 102行
2019-05-12
共2条回复

Vue全家桶+SSR+Koa2全栈开发美团网

整合大前端8项技术,全面晋级全栈工程师,毕设/面试作品

2445 学习 · 1638 问题

查看课程