1

So today I tried to get going with MongoDB on my computer but run into troubles right from the start.

After I installed mongo on my machine, It tried to run "mongod" and "mongo" in Git Bash but with no luck. The error I get is "mongod: not found"/"mongo: not found" respectively.

Now I saw in some answers here people recommending to change the enviromental variable PATH on my machine to the path to the mongod/mongo full path.

But the problem is that on my machine this variable is already set to the path of my npm (C:\Users\Me\AppData\Roaming\npm).

Will changing the path variable help me here or will it cause issues with npm?

Thanks!

Jonathan.Brink
  • 23,757
  • 20
  • 73
  • 115
Roman Timm
  • 65
  • 1
  • 11

4 Answers4

1

But the problem is that on my machine this variable is already set to the path of my npm

The PATH environment variable is a delimited set of paths, not just one path. On windows it is delimited by a semi-colon ";".

So, append the path to mongo to your PATH environment variable.

Here are some instructions for setting environment variables.

Here is a related question regarding setting PATH for Mongo.

Community
  • 1
  • 1
Jonathan.Brink
  • 23,757
  • 20
  • 73
  • 115
1

From my experience I would recommend setting the PATH variable of mongodb to its bin folder in the installation path. So it would be, per example, D:\MongoDB\Server\3.0\bin, add that to your path variable and it should work. You shouldn't have any npm issues.

Luís Cunha
  • 154
  • 2
  • 11
1

You don't want to replace PATH, you want to append to it: PATH is actually a list of paths. In windows this is semi-colon delimited: set PATH=%PATH%;/path/to/mongo and *nix (which Git Bash should mimic) it's colon delimited: export PATH=$PATH:/path/to/mongo.

Guildencrantz
  • 1,875
  • 1
  • 16
  • 30
-2

I use mongodb with git bash in windows. Install normaly, set the directory in c:/mongodb --> automaticaly set bin, mongo.exe, mongod.exe and all de files. Create in c:/data/db --> console with mkdir data/db or in windows area

Open your git bash :  
cd .. 
--> cd.. 
--> cd c:/mongodb/bin/ 
--> ls
in this console 
./mongod

in other console open

--> cd .. 
--> cd.. 
--> cd c:/mongodb/bin/  
--> ls
./mongo

(before version git bash only mongod and mongo , In this case is ./mongod and ./mongo)

PD: I sorry for my english :p

Venkat.R
  • 7,420
  • 5
  • 42
  • 63
joelengt
  • 9
  • 1