0
votes

I'm trying to install a MEAN stack in a windows machine and I am following this tutorial https://www.youtube.com/watch?v=vbxVuaw_ktw But I get an error. I confirmed the path is correct but I still get this error

This is the code I am using according to my paths and the error

$ ./mongod --directoryperdb --dbpath "C:/Program Files/MongoDB/Server/3.2/data/db" --logpath "C:/Program Files /MongoDB/Server/3.2/data/log/mongodb.log" --logappend

2016-11-15T14:08:29.071-0500 F CONTROL [main] Failed global initialization: FileNotOpen: Failed to open "C:/Program Files/MongoDB/Server/3.2/data/log/mongodb.log"

It looks like it's escaping the space in Program Files instead of treating it as one single Path location. Is that what's happening? How do I get passed this point?

Thanks

1
Put all the paths in quotes like this - "C:/Program Files/MongoDB/Server/3.2/data/db" - Abhay PS
For your information, putting things like data and logs under C:\Program Files isn't good practice - that's supposed to be for the application's executable files. Try using C:\ProgramData, or a location under your user's workspace. - Vince Bowdren
as Abhay said the value of dbpath should be enclosed in double quotes as well as the value for logpath. - satish chennupati
@AbhayPS I saw that in another tutorial and tried it and it still didn't accept it. I guess I forgot to mention that in my question. - LOTUSMS
Can you try it again with the values quoted, and update your question with these details if you're still getting the same problem? - Vince Bowdren

1 Answers

0
votes

If you are receiving this error, most likely you've been using GitBash. Instead, use Command Prompt (Admin) and use the code as shown below

mongod --directoryperdb --dbpath C:/Program Files/MongoDB/Server/3.2/data/db --logpath C:/Program Files /MongoDB/Server/3.2/data/log/mongodb.log --logappend

As suggested by Vince Bowdren (see comments on the question). Do not use Program Files. It is much better to use the user's workplace or project's root. However for the sake of learning MongoDB any place is as good as any.