我正在运行一些代码,当我npm start
出现此错误时:
throw new TypeError('Router.use() requires a middleware function but got a ' + gettype(fn))
^
TypeError: Router.use() requires a middleware function but got a Object at Function.use (/bustabit-webserver/node_modules/express/lib/router/index.js:458:13)
at Function.<anonymous> (/bustabit- webserver/node_modules/express/lib/application.js:220:21)
at Array.forEach (<anonymous>)
at Function.use (/bustabit- webserver/node_modules/express/lib/application.js:217:7)
at Object.<anonymous> (/bustabit-webserver/server/index.js:93:9)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
server / index.js的第92行是
app.use('/client_old', express.static(path.join(__dirname, '../client_old'), { maxAge: twoWeeksInSeconds * 1000 }));