Pipeline
Pipeline

Reputation: 1059

Command prompt not recognizing MongoDB even when added to environment PATH

I am new to the MEAN stack and am trying to implement a tutorial here:https://scotch.io/tutorials/build-a-restful-api-using-node-and-express-4

I am simply trying to install packages I need which are both node.js, express,js, and MongoDB.

My steps after trying to troubleshoot:

  1. I have installed MongoDB 3.2.1 from their site onto my local machine and it is stored at path C:\Program Files\MongoDB\Server\3.2\bin\

(I can navigate to C:\Program Files\MongoDB\Server\3.2\bin in my command prompt window and type mongo and have it run)

  1. I went to Control Panel -> System Settings -> Security -> Advanced -> Environment Varaibles -> and under system varialbles:

Earlier I had to add a path for node.js (C:\Program Files\nodejs works fine for running node at any directory level)

So I tried adding a system variable: MongoDB at "C:\Program Files\MongoDB\Server\3.2\bin\mongo"

So the ultimate goal is for me to be able to navigate to a folder strucutre on my desktop and run:

"node --version" "express --version" "mongo --version" and have them all be properly installed and available so that I can move on to my application creation.

Any help would be appreciated, thanks.

Upvotes: 1

Views: 3409

Answers (3)

ClvrBug
ClvrBug

Reputation: 11

I had the same problem when I did the installation on ParrotOS, when I wanted to run the Mongo shell on the terminal with the command mongo it prompted me that the the command wasn't recognize. Same problem with Windows after I edited the variable path.

The command mongod ran for me the shell in both OS without problems. It could be something that was added with new versions of MongoDB.

If someone else knows more about what this happens, ill be more than happy to know.

Upvotes: 0

Yuresh Karunanayake
Yuresh Karunanayake

Reputation: 567

Basically path variable in a system stores the paths to executable files and programs.

1 System.

2 Advanced system settings.

3 Environment Variables.

4 Double click on 'path' in your User tab.

5 click 'New'.

6 Then add your mongo bin location. ex:- my one --> C:\Program Files\MongoDB\Server\3.6\bin.

7 Click OK.

Then try in cmd again for the result

Upvotes: 0

a-h
a-h

Reputation: 4284

The command line works by looking in all of the directories specified by the PATH environment variable.

From what I can see, you've included the name of the executable (mongo) in the PATH, when you just need to include the directory.

Just for completeness, on my PC, the PATH variable looks something like this:

C:\Program Files (x86)\Python35-32\Scripts\;C:\Program Files\apache-maven-3.3.9\bin;C:\Program Files\MongoDB\Server\3.2\bin

Environment Variables

Upvotes: 2

Related Questions