关于快递4路由器和推

E:\ wordspace \ javascript \ nodejs-demo \ node_modules \ express \ lib \ router \ index.js:502 this.stack.push(layer);

TypeError: Cannot read property 'push' of undefined at Function.route (E:\wordspace\javascript\nodejs-demo\node_modules\express\lib\router\index.js:502:13) at Function.proto.(anonymous function) [as get] (E:\wordspace\javascript\nodejs-demo\node_modules\express\lib\router \index.js:509:22) at Object.<anonymous> (E:\wordspace\javascript\nodejs-demo\routes\movie.js:6:8) at Module._compile (module.js:435:26) at Object.Module._extensions..js (module.js:442:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:313:12) at Module.require (module.js:366:17) at require (module.js:385:17) at Object.<anonymous> (E:\wordspace\javascript\nodejs-demo\app.js:11:13) at Module._compile (module.js:435:26) at Object.Module._extensions..js (module.js:442:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:313:12) at Module.require (module.js:366:17) at require (module.js:385:17) 

这是我的错误报告。

我不能忍受这个问题的根源,需要一种方法来解决这个问题。

这是我的代码。

movie.js

 var Movie = require('./../models/Movie.js'); var express = require('express'); var router = express.Router; /* Get add page. */ router.get('/movie/add', function(req, res, next){ if(req.params.name){ return res.render('movie', { title:req.params.name+'|电影|pipe理|movie.me', label:'编辑电影:'+req.params.name, movie:req.params.name }); } else { return res.render('movie', { title:'新增加|电影|pipe理|movie.me', label:'新增加电影', movie:false }); } }); router.post('/movie/add', function(req, res, next){ res.send({'success':true}); }); 

app.js

 var routes = require('./routes/index'); var movie = require('./routes/movie'); var users = require('./routes/users'); app.use('/', routes); app.use('/movie', movie); app.use('/users', users); 

请帮帮我。

       

网上收集的解决方案 "关于快递4路由器和推"