‘mongo’ is not recognized as an internal or external command
Today in this article, we will cover the below aspects for resolving the common error “mongo is not recognized”
Issue Description
Mongo command line/CLI command gives the below error,
'mongo' is not recognized as an internal or external command, operable program or batch file.
This issue I found to be due to not setting up the environment variable on a machine where you have installed the MongoDB component.
Resolution
On a Windows machine, you need to set up a MongoDB environment variable.
Please follow below high-level steps required for you to fix the issue.
- Check the file path for MongoDB installation
Usually, Mongo exe will be available in the below location,
If using MongoDB 4.0 version,
C:\Program Files\MongoDB\Server.0\bin
OR
If using MongoDB 4.2 version,
C:\Program Files\MongoDB\Server.2\bin
- Update the System environment variable for the above paths,
Note:
- To make the variable effective, please close any existing CMD window and launch a new one.
- Sometimes restarting may also help set up the required environment variable.
References:
That’s all! Happy coding!
Does this help you fix your issue?
Do you have any better solutions or suggestions? Please sound off your comments below.
Please bookmark this page and share it with your friends. Please Subscribe to the blog to receive notifications on freshly published(2024) best practices and guidelines for software design and development.
also not working so how can i solve this error
Rahul – Please try both the approaches discussed. Please check the location of path for utilities like Mongo exe etc and set up the environment path accordingly.