Ever Since Upgrade: TypeError: Cannot read property 'Store' of undefined
See original GitHub issueI upgraded connect-mongo today and my application keeps crashing due to the following error. Can anyone contribute any advice on this issue?:
/Desktop/node/application/node_modules/connect-mongo/lib/connect-mongo.js:30
var Store = connect.session.Store;
^
TypeError: Cannot read property 'Store' of undefined
//express/mongo session storage
app.use(express.session({
secret: '90s8fa0s8fa',
store: new mongoStore({
url: config.db,
collection: 'sessions'
})
}));
Issue Analytics
- State:
- Created 10 years ago
- Comments:11
Top Results From Across the Web
Cannot read property 'store' of undefined in Javascript class
Getting back into web after doing mobile for the last four years so I'm a little rusty :) Thanks import React from 'react';...
Read more >cannot read properties of null (reading 'store') - You.com
To solve the "Cannot read property 'value' of null" error, make sure that the JS script tag is placed at the bottom of...
Read more >Cannot Read Property Length of Undefined in JavaScript
The JavaScript TypeError: Cannot read property 'length' of undefined occurs when the length property is read on an undefined variable.
Read more >REDUX: Cannot read properties of undefined (reading 'type')
/store/index.js import {createStore} from "redux"; import reducer from "../reducers/index"; const initialState = { quotes: { "name1": "lorem ...
Read more >How to Avoid the Infamous "Cannot read properties of ... - Bitovi
That error message is telling you the function is returning undefined implicitly, but its return type does not include undefined in it. Awesome!...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For any other suckers out there who are banging their head against this, also remember that you need to add session after you require connect-mongo:
This will cause the same error!
I advice you upgrade your package.json dependencies install connect-mongo then in your terminal, cd to your project root directory and enter the following:
npm install -g npm-check-updates
ncu -u
npm updates
npm install
then follow the steps in the ‘connect-mongo’ npm site