I am trying to create my local environment to contribute to freeCodeCamp. However, when I run the command npm run seed
, it throws an error I don’t understand. It says MongoDB cannot connect.
I wanted to solve a tiny issue but instead have spent 1h solving many bugs. I feel exhausted. Moreover, the issue has been solved by somebody else while I was having that trouble. Anyway, I will get over it!
❯ npm run seed
> @freecodecamp/freecodecamp@0.0.1 seed
> cross-env DEBUG=fcc:* node ./tools/scripts/seed/seedAuthUser
(node:27825) [MONGODB DRIVER] Warning: Current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
(Use `node --trace-warnings ...` to show where the warning was created)
Oh noes!! Error seeding local auth user.
MongoNetworkError: failed to connect to server [localhost:27017] on first connect [Error: connect ECONNREFUSED 127.0.0.1:27017
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1146:16) {
name: 'MongoNetworkError'
}]
at Pool.<anonymous> (/Users/arnau/Desktop/opensource/freeCodeCamp/tools/scripts/seed/node_modules/mongodb/lib/core/topologies/server.js:438:11)
at Pool.emit (events.js:315:20)
at /Users/arnau/Desktop/opensource/freeCodeCamp/tools/scripts/seed/node_modules/mongodb/lib/core/connection/pool.js:562:14
at /Users/arnau/Desktop/opensource/freeCodeCamp/tools/scripts/seed/node_modules/mongodb/lib/core/connection/pool.js:995:11
at /Users/arnau/Desktop/opensource/freeCodeCamp/tools/scripts/seed/node_modules/mongodb/lib/core/connection/connect.js:32:7
at callback (/Users/arnau/Desktop/opensource/freeCodeCamp/tools/scripts/seed/node_modules/mongodb/lib/core/connection/connect.js:280:5)
at Socket.<anonymous> (/Users/arnau/Desktop/opensource/freeCodeCamp/tools/scripts/seed/node_modules/mongodb/lib/core/connection/connect.js:310:7)
at Object.onceWrapper (events.js:422:26)
at Socket.emit (events.js:315:20)
at emitErrorNT (internal/streams/destroy.js:106:8)
npm ERR! code 1
npm ERR! path /Users/arnau/Desktop/opensource/freeCodeCamp
npm ERR! command failed
npm ERR! command sh -c cross-env DEBUG=fcc:* node ./tools/scripts/seed/seedAuthUser
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/arnau/.npm/_logs/2021-05-16T19_28_34_743Z-debug.log