**Authentication with Socket.IO** - connect-mongo-

Tell us what’s happening:
Hi, I did everything step by step with the guide but it returned the following error code. I then tried to copy the model answer to my server.js and it also returned the same error code. What’s wrong?

const MongoStore = require('connect-mongo')(session);

TypeError: require(...) is not a function
    at Object.<anonymous> (/home/runner/boilerplate-advancednode-1/server.js:17:44)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
    at internal/main/run_main_module.js:17:47
npm ERR! errno 1
npm ERR! fcc-advanced-node-and-express@0.0.1 start: `node server.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the fcc-advanced-node-and-express@0.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/runner/.npm/_logs/2021-02-25T03_41_40_750Z-debug.log
exit status 1

Your project link(s)

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36.

Challenge: Learn How JavaScript Assertions Work

Link to the challenge:


I had the same problem and probably anyone doing the challenge from now on.

connect-mongo recently released a mayor update with breaking changes.

I could solve this error by downgrading it to version “3.0.2”.


Great thanks for this, I’ve been having the same issue, and this fixed it. For future reference, is the best way to solve this type of issue is by look on npm at the version history? So for “connect-mongo” here and roll it back in package.json?

Thank you, for bringing this up. We were expecting this to happen sometime:
Advanced Node and Express - Package Versioning · Issue #39521 · freeCodeCamp/freeCodeCamp (github.com)

God bless you and this post on the forum. This solved the same problem for me as well.

I had same issue and I solved it by going to the package.json file and manually changing the “connect-mongo” to “3.2.0” and also remember to remove the caret sign (^)before the number 3 because the caret sign means can add the mentioned version or the latest version of the package whereas we want only the version that we mentioned there.
I passed the challenge with just this fix. cheers.