0
votes

I'm using vagrant and virtualbox with precise32 for my setup. Installed Node.js v0.10 using:

  1. curl -sL https://deb.nodesource.com/setup_0.10 | sudo bash -
  2. sudo apt-get install -y nodejs

and i can't seem to sudo node the following:

var everyauth = require('everyauth');
var nconf = require('nconf');
var Recaptcha = require('recaptcha').Recaptcha;
var crypto = require('crypto');
var connect = require('connect');
var cookie = require('cookie');
var express = require('express');

var models = require('./models/');
var hash = require('./hash');
var config = require('./config');

/* load API keys */
nconf.env().file({file: 'settings.json'});

var session_store = new connect.session.MemoryStore();

I got the following error:

   TypeError: Cannot read property 'MemoryStore' of undefined
    at Object.<anonymous> (/vagrant/app/auth.js:16:40)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/vagrant/app/app.js:8:12)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:945:3
 at node.js:945:3

I have to say that 3 years ago when I made the project, I simply did 'sudo npm install' and the tried to run and everythin was fine. I am thinking there is a incompatibility issue between js and the newly installed npm.

1

1 Answers

0
votes

Change

var connect = require('connect');
...
var session_store = new connect.session.MemoryStore();

to

let app = express();
let session = require('express-session');
app.use(session({ ... });

Or install old version (2.x, 3.x) of Express