RedisStore - TypeError: Cannot read property 'prototype' of undefined

When I run the app I get that message. I am trying to follow the instructions described here

This is a portion of my app.js file

var express = require('express');
var RedisStore = require('connect-redis')(express); 
var redisStore = new RedisStore(); // setup redis
var flash = require('connect-flash');
var passport = require('passport');
var LocalStrategy = require('passport-local').Strategy;
var routes  = require('./routes')

Answers


If you want to use Express 4.x

change from

var express = require('express');
var RedisStore = require('connect-redis')(express);

to

var session = require('express-session')
var RedisStore = require('connect-redis')(session);

Also remember to install express-session:

npm install express-session --save

If you plan to use Express 3.x, pick compatible version 1.4.7 of connect-redis to avoid the error.

 npm install connect-redis@1.4.7 --save

To get more information about migrating Express 3 to version 4:


Need Your Help

Should native validations be tested in rails?

ruby-on-rails unit-testing validation

Everybody knows that automated testing is a good thing.