D:\myBlog\myBlog\node_modules\express\lib\application.js:209
throw new TypeError('app.use() requires middleware functions');
^
TypeError: app.use() requires middleware functions
at EventEmitter.use (D:\myBlog\myBlog\node_modules\express\lib\application.js:209:11)
at Object.<anonymous> (D:\myBlog\myBlog\server\app.js:12:5)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "E:\软件\node.js\node.exe" "E:\软件\node.js\node_modules\npm\bin\npm-cli.js" "run" "start"
npm ERR! node v6.9.4
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! xhd-blog@1.0.0 start: node server/app.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the xhd-blog@1.0.0 start script 'node server/app.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the xhd-blog package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node server/app.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs xhd-blog
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls xhd-blog
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! D:\myBlog\myBlog\npm-debug.log
谢谢
你的app.js使用app.use(middleware),里面必须传递一个中间件函数,你直接使用app.use()没传递参数。
中间件函数可以是别人的中间件包,如cookie-parser,body-parser,或者自己写的中间件,符合如下结构
soonfy