EthanRBrown / web-development-with-node-and-express

Companion repository to Web Development With Node and Express, first edition.
1.02k stars 501 forks source link

Getting an error - Cannot find module 'express-session' #14

Open dsm-kbl opened 9 years ago

dsm-kbl commented 9 years ago

I am following the book and I get this error when I try to start my server. I tried to install the module express-session but doesn't work. It says

throw err; Cannot find module 'express-session'

on this line - app.use(require('express-session')({ store : sessionStore }));

How can i solve this problem?

EthanRBrown commented 9 years ago

I just tried it and it worked fine for me. I have noticed two facts about npm that may help you. Sometimes there are temporary interruptions in the npm service, and sometimes just running npm install a second time will do the trick. Secondly, even though it shouldn't be necessary, I've had npm fail on me if I didn't run it with root privileges, so you might try sudo npm install as well. Let me know if either of these suggestions help....

dsm-kbl commented 9 years ago

Hi Ethan, I just run npm install again and somehow it installed express-session. I got some warnings and now somehow i get a new error in this line.

app.use(vhost('api.*', rest.restler(apiOptions))); TypeError: Object # has no method 'restler'

Any ideas?

EthanRBrown commented 9 years ago

I'm sorry its taken me so long to respond.... It looks like this is an obsolete use of the rest package...did you find that in the book or the repository?