首先,在这种情况下,我是MEAN的新手Node,所以我希望我不会因为可能缺乏有关我收到的错误的信息而激怒任何人。
我的应用程序在昨天重新启动Webstorm并重新连接到我的MongoDB之后确实没有任何问题,然后启动节点我在终端中收到了这些错误。我没有更改单个文件,它随机开始抛出这些错误,所以既然我是新手,我会很感激任何线索或建议,以解决这个问题。
Jake-MBP:test jake$ npm start
> test@0.0.0 start /Users/jake/WebstormProjects/test
> node ./bin/www
/Users/jake/WebstormProjects/test/node_modules/express/lib/router/route.js:196
throw new Error(msg);
^
Error: Route.post() requires callback functions but got a [object Undefined]
at Route.(anonymous function) [as post] (/Users/jake/WebstormProjects/test/node_modules/express/lib/router/route.js:196:15)
at Function.proto.(anonymous function) [as post] (/Users/jake/WebstormProjects/test/node_modules/express/lib/router/index.js:510:19)
at Object.<anonymous> (/Users/jake/WebstormProjects/test/models/survey.js:7:8)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/Users/jake/WebstormProjects/test/controllers/surveysController.js:1:63)
npm ERR! Darwin 15.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v4.3.0
npm ERR! npm v2.14.12
npm ERR! code ELIFECYCLE
npm ERR! test@0.0.0 start: `node ./bin/www`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the test@0.0.0 start script 'node ./bin/www'.
npm ERR! This is most likely a problem with the test package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./bin/www
npm ERR! You can get their info via:
npm ERR! npm owner ls test
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/jake/WebstormProjects/test/npm-debug.log
如上所述,我在此错误之前没有更改任何内容。