Trouble getting set up

Trouble getting set up
0

#1

I’m in the process of trying to get set up for the Open Source projects. I’ve forked and cloned the FreeCodeCamp GitHub repository and have all the dependencies installed, including MongoDB and Gulp.

However, when I run “npm run only-once”, I get this error message:

Connection fails: MongoError: failed to connect to server [localhost:27017] on first connect [Mongo
Error: connect ECONNREFUSED 127.0.0.1:27017]

C:\Users\myname\Documents\fcc-nonprofit\freeCodeCamp\node_modules\rx\dist\rx.js:77
    throw e;
    ^
MongoError: failed to connect to server [localhost:27017] on first connect [MongoError: connect ECO
NNREFUSED 127.0.0.1:27017]
    at Pool.<anonymous> (C:\Users\myname\Documents\fcc-nonprofit\freeCodeCamp\node_modules\mongodb-
core\lib\topologies\server.js:336:35)
    at emitOne (events.js:96:13)
    at Pool.emit (events.js:188:7)
    at Connection.<anonymous> (C:\Users\myname\Documents\fcc-nonprofit\freeCodeCamp\node_modules\mo
ngodb-core\lib\connection\pool.js:280:12)
    at Connection.g (events.js:291:16)
    at emitTwo (events.js:106:13)
    at Connection.emit (events.js:191:7)
    at Socket.<anonymous> (C:\Users\myname\Documents\fcc-nonprofit\freeCodeCamp\node_modules\mongod
b-core\lib\connection\connection.js:187:49)
    at Socket.g (events.js:291:16)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at emitErrorNT (net.js:1276:8)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)
From previous event:
    at createNodeObservable (C:\Users\myname\Documents\fcc-nonprofit\freeCodeCamp\node_modules\rx\d
ist\rx.async.js:313:11)
    at C:\Users\myname\Documents\fcc-nonprofit\freeCodeCamp\node_modules\rx\dist\rx.async.js:357:12
    at Object.<anonymous> (C:\Users\myname\Documents\fcc-nonprofit\freeCodeCamp\seed\index.js:30:3)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)
    at bootstrap_node.js:509:3

Any help would be appreciated.


#2

Do you have mongodb running?


#3

Yes, I have MongoDB running.


#4

So if you type the command: mongo it correctly starts the mongo shell?


#5

Well, when I type in mongo in my terminal (I’m using Visual Studio Code, by the way), it says mongo isn’t a cmdlet or function. I do have MongoDB on my desktop however and I currently have it up and running.

I’m also on Windows instead of OS X, so according to the contribution file on the FreeCodeCamp GitHub repository, I’m supposed to put "“C:\Program Files\MongoDB\Server\3.4\bin\mongod”, which I do and then follow it with “npm run only-once”, which throws up the error.

I will admit that I’m not that experienced with MongoDB so I could be missing something very obvious or I just need to take the time to learn it better.


#6

So you having somehting like this open:

The above is running mongod. Then in a separate console you would run npm run only-once.


#7

Yes, I have something exactly like that open when I open it on the desktop.

However, when I type in mongod into the terminal, it tells me it’s not a cmdlet or function, so I can only open it on the desktop. I’ve tried installing mongodb via npm (npm install mongodb --save), but that does not seem to be helping.


#8

You most likely haven’t added mongodb to your PATH variable.


#9

Okay. So how do I add it?


#10
  • Search Windows for something like “Edit the environment variables of the system”
  • You should get a popup with a title of “System properties” with the “Advanced” tab open
  • Click “Environment variables”
  • Double click “Path”
  • Click “New”
  • Paste the link to the mongo bin directory (for me: C:\Program Files\MongoDB\Server\3.4\bin)

#11

Okay, thanks. I’ll see if that does the trick. It could also be that I didn’t install MongoDB properly to my computer. I might try reinstalling it just in case. Thanks again for your help.