TypeError: Object #<IncomingMessage> has no method 'flash'
JavaScript相关代码:
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执行脚本问题就消失了。
TypeError: Object #<IncomingMessage> has no method 'flash'的更多相关文章
- Kibana TypeError : Object #<GlobalState> has no method 'setDefaults'
在windows server中装完elasticsearch和kibana后,elasticsearch能正常访问(http://localhost:9200): 而访问kibana的地址(http ...
- Node.js中测试mysql的代码var client = mysql.createClient运行出错:TypeError: Object # has no method ‘createClient’
今天在WebStorm下熟悉一个node.js的项目,配置环境时,手一抖,将mysql包从0.8升级到了2.1.1,结果再运行时就出错了. [Fri Mar 14 2014 17:05:49] 连接数 ...
- [Android] Web Console: Uncaught TypeError: Object [object Object] has no method 'xxx'
我们开发的产品,有一部分功能,需要在WebView中打开web页面,然后在web页面中通过js方法回调部分native的功能. 对于web回调native的开发方式,如果不了解的话,可以参考我以前的一 ...
- [Android]通过js方法回调部分native报错 Web Console: Uncaught TypeError: Object [object Object] has no method 'xxx'
在android4.2以前,注入步骤如下: webview.getSetting().setJavaScriptEnable(true); class JsObject { public String ...
- Uncaught TypeError: Object #<Object> has no method 'fancybox'
Uncaught TypeError: Object #<Object> has no method 'fancybox' 2011-10-24 16:51:19| 分类: html|举 ...
- Android webview js 调用java方法报错"Uncaught TypeError: Object [object Object] has no method xx
webview开发,在Android4.4下js调用java方法报错"Uncaught TypeError: Object [object Object] has no method,同样的 ...
- TypeError: Object function (req, res, next) { app.handle(req, res, next); } has no method 'configure'
TypeError: Object function (req, res, next) { app.handle(req, res, next); } has no method 'configure ...
- 360浏览器Uncaught TypeError: object is not a function问题
刚刚360浏览器提示 Uncaught TypeError: object is not a function,找了半天发现问题是我有一个按钮,id和方法重复了,所以提示这个. <input t ...
- 转: object 和embed 标签播放flash
一.介绍: 我们要在网页中正常显示flash内容,那么页面中必须要有指定flash路径的标 签.也就是OBJECT和 EMBED标签.OBJECT标签是用于windows平台的IE浏览器的,而EMBE ...
随机推荐
- Apps Vol53
Android 內購破解 Freedom 軟件 iOS破解軟件IAPFree 能偽造UID IAPFree : 系統已經JB Cydia加入作者的軟件源 Cydia.crazydoraemon.c ...
- PHP与MySQL中编码的设置
php代码 header("Content-type:text/html;Charset=utf8"); myql_query("set names utf8" ...
- jquery实现简单的ajax
-->html页 1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "htt ...
- HTML+CSS学习笔记 (11) - CSS盒模型
元素分类 在讲解CSS布局之前,我们需要提前知道一些知识,在CSS中,html中的标签元素大体被分为三种不同的类型:块状元素.内联元素(又叫行内元素)和内联块状元素. 常用的块状元素有: <di ...
- UI2_UICollectionViewPicture
// AppDelegate.m // UI2_UICollectionViewPicture // // Created by zhangxueming on 15/7/16. // Copyrig ...
- ubuntu下安装git,sublime,nodejs
用的是VMware10.0版本的虚拟机,很早之前下载的今天就直接用了,安装挺简单记得需要一个序列号.在这里:http://mirrors.163.com/ubuntu-releases/15.04/u ...
- 使用DbVisualizer 8 连接Oracle数据库
1. 网上下载一个驱动包ojdbc14.jar,放到oracle目录下:...\DbVisualizer-8.0.1\jdbc\oracle\ojdbc14.jar 2. 打开 DbVisualize ...
- 在ArcGIS中WGS84大地坐标和投影平面坐标的转换
以WGS84转换为北京54坐标为例: 首先你要先知道转化的参数,鉴于我国曾使用不同的坐标基准(BJ54.State80.Correct54),各地的重力值又有很大差异,所以很难确定一套适合全国且精度较 ...
- 转帖:使用TortoiseGit处理代码冲突
原址:http://www.cnblogs.com/jason-beijing/p/5718190.html 场景一 user0 有新提交 user1 没有pull -> 写新代码 -&g ...
- 10+ powerful debugging tricks with Visual Studio
10+ powerful debugging tricks with Visual Studio Original link : http://www.codeproject.com/Articles ...