-
카테고리
-
세부 분야
백엔드
-
해결 여부
미해결
에러가 발생합니다..
18.04.30 00:42 작성 조회수 186
0
안녕하세요, 코드는 동일한데.. 아래와 같은 에러가 등장합니다.
어떤 것이 문제 일까요?
환경은 웹스톰 입니다!
/usr/local/bin/node --inspect-brk=58575 /Users/juno/IdeaProjects/WebstormProjects/node-modeluer/express_index.js
Debugger listening on ws://127.0.0.1:58575/defc4bde-ef4f-4bc8-84b7-04624b59c3f6
For help see https://nodejs.org/en/docs/inspector
Debugger attached.
commonmw
/Users/juno/IdeaProjects/WebstormProjects/node-modeluer/express_index.js:9
next(new Error('error ouccered'));
^
TypeError: next is not a function
at commonMW (/Users/juno/IdeaProjects/WebstormProjects/node-modeluer/express_index.js:9:5)
at Object. (/Users/juno/IdeaProjects/WebstormProjects/node-modeluer/express_index.js:27:9)
at Module._compile (internal/modules/cjs/loader.js:651:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
at Module.load (internal/modules/cjs/loader.js:566:32)
at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
at Function.Module._load (internal/modules/cjs/loader.js:498:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)
at startup (internal/bootstrap/node.js:201:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:516:3)
Waiting for the debugger to disconnect...
Process finished with exit code 1
답변을 작성해보세요.
0
김정환
지식공유자2018.04.30
TypeError: next is not a function
이 부분이 원인인것 같네요. 에러미들웨어는 인자가 4개입니다.
function errormw (err, req, res, next)
이런 식으로 정의했는지 확인해 보실래요?
답변 1