Issue setting up freecodecamp locally

Tell us what’s happening:

I am following this guide and i got stuck because of an error i get when running the command

npm run seed

here is the error:

➜  freeCodeCamp git:(main) npm run seed

> @freecodecamp/freecodecamp@0.0.1 seed /home/robdll/code/opensource/freeCodeCamp
> cross-env DEBUG=fcc:* node ./tools/scripts/seed/seedAuthUser

internal/modules/cjs/loader.js:905
  throw err;
  ^

Error: Cannot find module 'mongodb'
Require stack:
- /home/robdll/code/opensource/freeCodeCamp/tools/scripts/seed/seedAuthUser.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
    at Function.Module._load (internal/modules/cjs/loader.js:746:27)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:101:18)
    at Object.<anonymous> (/home/robdll/code/opensource/freeCodeCamp/tools/scripts/seed/seedAuthUser.js:4:35)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:75:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/robdll/code/opensource/freeCodeCamp/tools/scripts/seed/seedAuthUser.js'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @freecodecamp/freecodecamp@0.0.1 seed: `cross-env DEBUG=fcc:* node ./tools/scripts/seed/seedAuthUser`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @freecodecamp/freecodecamp@0.0.1 seed 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/robdll/.npm/_logs/2022-08-07T17_45_10_576Z-debug.log

Before that I have properly installed the dependencies via

npm ci

here is the output

➜  freeCodeCamp git:(main) npm ci


> core-js-pure@3.19.2 postinstall /home/robdll/code/opensource/freeCodeCamp/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js:
> https://opencollective.com/core-js 
> https://patreon.com/zloirock 
> https://paypal.me/zloirock 
> bitcoin: bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> docsify@4.12.2 postinstall /home/robdll/code/opensource/freeCodeCamp/node_modules/docsify
> opencollective-postinstall

Thank you for using docsify!
If you rely on this package, please consider supporting our open collective:
> https://opencollective.com/docsify/donate


> cypress@9.7.0 postinstall /home/robdll/code/opensource/freeCodeCamp/node_modules/cypress
> node index.js --exec install

Note: Skipping binary installation: Environment variable CYPRESS_INSTALL_BINARY = 0.


> @freecodecamp/freecodecamp@0.0.1 prepare /home/robdll/code/opensource/freeCodeCamp
> husky install

husky - Git hooks installed
added 1360 packages in 11.032s

Browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36

OS information:

Ubuntu 22

Did you perform step 3?

Step 3: Start MongoDB and seed the database

Before you can run the application locally, you will need to start the MongoDB service.

[!NOTE] Unless you have MongoDB running in a setup different than the default, the URL stored as the MONGOHQ_URL value in the .env file should work fine. If you are using a custom configuration, modify this value as needed.

Start the MongoDB server in a separate terminal:

macOS/Linux

mongod

yes the terminal where i run mongod has this as last msg:

{“t”:{“$date”:“2022-08-07T13:58:41.885-04:00”},“s”:“I”, “c”:“STORAGE”, “id”:22430, “ctx”:“Checkpointer”,“msg”:“WiredTiger message”,“attr”:{“message”:“[1659895121:885481][40987:0x7f1400e4e640], WT_SESSION.checkpoint: [WT_VERB_CHECKPOINT_PROGRESS] saving checkpoint snapshot min: 58, snapshot max: 58 snapshot count: 0, oldest timestamp: (0, 0) , meta checkpoint timestamp: (0, 0) base write gen: 10”}}

I’ve also checked if the service is listening on the correct port:

➜ freeCodeCamp git:(main) sudo lsof -i -P -n | grep LISTEN | grep mongod

mongod 40987 root 11u IPv4 190335 0t0 TCP 127.0.0.1:27017 (LISTEN)

issue was related to wrongful node version, moving to 16+ solved the issue