Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ch13: Cannot read property 'Store' of undefined #108

Open
yejia4869 opened this issue Sep 19, 2018 · 3 comments
Open

Ch13: Cannot read property 'Store' of undefined #108

yejia4869 opened this issue Sep 19, 2018 · 3 comments

Comments

@yejia4869
Copy link

Hi Ethan

The book is very easily to understand and attracts me to learn deeply.
but I stuck in ch13 by the following error:

../meadowlark/node_modules/session-mongoose/index.js:266
})(connect.session.Store);
....................^
TypeError: Cannot read property 'Store' of undefined

Initially, I thought it was the problem of "session-mongoose", so I searched this package on npmjs website and
found this:

IMPORTANT: This module currently supports legacy versions of connect (2.x) and express (2.x and 3.x) due to extensive changes made to those modules.
Until support for latest modules are added, this module should not be used with latest versions of connect and express.

However, when I managed to install connect@2.x in my project, I found the connect@2.x series is deprecated. It got me...

Am I missing something? Any way to improve this?

@EthanRBrown
Copy link
Owner

Hi, @yejia4869; I'm glad you're enjoying the book...sorry you're encountering issues.

Unfortunately, the content is pretty significantly out of date at this point. I do have a second edition on the way, but it probably won't hit the shelves until Q2 2019 (early releases sooner, I imagine).

Without diving into this more deeply, I'm afraid all I can suggest is that you install the exact version numbers listed in ch13/package.json.... In other words, when you install them, do it like this:

$ npm add body-parser@1.3.0
$ npm add connect@2.19.5
$ ...

And so on...let me know if that doesn't solve the problem....

(Note that chai in the dependencies should really be in the dev dependencies. Doesn't hurt anything, but oops!)

@LeThao98
Copy link

LeThao98 commented Sep 26, 2018

I'm also encoutering it.I added lastest connect and express, but it isn't fixed

D:\web-development-with-node-and-express\ch13\node_modules\session-mongoose\index.js:266
})(connect.session.Store);
^

TypeError: Cannot read property 'Store' of undefined
at module.exports (D:\web-development-with-node-and-express\ch13\node_modules\session-mongoose\index.js:266:24)
at Object. (D:\web-development-with-node-and-express\ch13\meadowlark.js:88:47)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Function.Module.runMain (module.js:694:10)
at startup (bootstrap_node.js:204:16)
at bootstrap_node.js:625:3

@EthanRBrown
Copy link
Owner

@LeThao98 the problem is exaclty using the latest connect/express. Please try with the explicit versions in the repo package.json file, per my comment above....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants