1

I am trying to install MongoDB on my personal machine for a Node project through the command line using npm install --save mongodb. MongoDB shows up in the dependencies in my package.json file with a current version, but when I run mongodb -v, mongod, or just try to open up the mongo shell by running "mongo" I get these errors:

"command not found: mongodb"
"command not found: mongod"
"command not found: mongo"

I have also tried running sudo mongod to no avail. Does anyone have any suggestions? I have looked at a lot of documentation at this point and am not sure where to turn.

swoopedj
  • 115
  • 2
  • 12

1 Answers1

1

Looks like you're just installing the node.js driver for Mongodb. npm is generally used as a package manager solely for node.js packages and dependencies. You need to install the actual database system using the binaries or a binary package installer e.g. Homebrew.

https://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/

https://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/

Related, and looks like your same issue.

andrsnn
  • 1,591
  • 5
  • 25
  • 43
  • Thanks! Installing mongodb through Homebrew seems to have gotten me part of the way there. However when I try to run mongod in the project directory, it starts up and then terminates, giving me this error: "I STORAGE [initandlisten] exception in initAndListen: 29 Data directory /data/db not found., terminating" , and for some reason when I run mongodb -v it still says "command not found: mongodb". I installed it at first in my home directory and and currently am getting these errors with it installed in my project directory. – swoopedj Feb 04 '16 at 04:31
  • check out this question: https://stackoverflow.com/questions/7948789/mongodb-mongod-complains-that-there-is-no-data-db-folder – andrsnn Feb 04 '16 at 17:47