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)这里出错了
022019-05-12
相似问题