TypeError: Object #<IncomingMessage> has no method 'flash'
2014-05-06 15:36
615 查看
JavaScript相关代码:
NodeJS下启动执行,返回如下错误
TypeError: Object #<IncomingMessage> has no method 'flash'
解决方法如下:
在app.js里添加如下代码:(本机的Express版本为4.0)
再启动NodeJS执行脚本问题就消失了。
router.post('/reg', function(req, res) { //检验用户两次输入的口令是否一致 if (req.body['password-repeat'] != req.body['password']) { req.flash('error', '两次输入的口令不一致'); return res.redirect('/reg'); } ..... });
NodeJS下启动执行,返回如下错误
TypeError: Object #<IncomingMessage> has no method 'flash'
解决方法如下:
npm install connect-flash
在app.js里添加如下代码:(本机的Express版本为4.0)
var flash = require('connect-flash'); app.use(flash());
再启动NodeJS执行脚本问题就消失了。
相关文章推荐
- Uncaught TypeError: Object #<Object> has no method 'fancybox'
- Uncaught TypeError: Object #<Object> has no method 'addEvents'
- Uncaught TypeError: Object #<Object> has no method 'addEvents' ext-all-debug异常
- Uncaught TypeError: Object #<Document> has no method 'load'
- Uncaught TypeError: Object #<Object> has no method 'addEvents'
- Uncaught TypeError: Object #<HTMLDivElement> has no method 'attr'
- Uncaught TypeError: Object #<HTMLCollection> has no method 'toLowerCase'问题
- 当使用JQuery的"$",抛异常Uncaught TypeError: Object #<Object> has no method 'ajax'
- TypeError: Object #<Object> has no method 'createClient'
- 出现TypeError: Object #<Object> has no method 'createClient' 错误
- [Android]通过js方法回调部分native报错 Web Console: Uncaught TypeError: Object [object Object] has no method 'xxx'
- Uncaught TypeError: Object [object Object] has no method 'live'
- [Android] Web Console: Uncaught TypeError: Object [object Object] has no method 'xxx'
- [Android] Web Console: Uncaught TypeError: Object [object Object] has no method 'xxx'
- Uncaught TypeError: Object [object Object] has no method 'live' 报错
- Python开发:AttributeError: 'Class_Of_LoanUseCase' object has no attribute '_type_equality_funcs'
- Uncaught TypeError: Object [object Object] has no method 'live'
- Error:(2, 0) No service of type Factory <LoggingManagerInternal> available in ProjectScopeServices.
- [Android] Web Console: Uncaught TypeError: Object [object Object] has no method 'xxx'
- 《python核心编程》序列:字符串、列表和元组Python: Attribute Error - 'NoneType' object has no attribute