MongoError: connect ECONNREFUSED 127.0.0.1:27017

后端 未结 21 1292
我在风中等你
我在风中等你 2020-12-14 08:40

I\'m using NodeJS wih MongoDB using mongodb package. When I run mongod command it works fine and gives "waiting for connection on port 27017". So, mongod seems to

相关标签:
21条回答
  • 2020-12-14 08:49

    most probably your mongo db service is not started. For ubuntu : sudo service mongod start For windows : go to services and start the MongoDB service

    also install link for mondoDB service https://www.mongodb.com/download-center/community

    I had this problem and i solved it thanks to this man's answer https://stackoverflow.com/a/47433551/7917608

    0 讨论(0)
  • 2020-12-14 08:53

    just start the mongo server from terminal

    Ubuntu -

         sudo systemctl start mongod
    
    0 讨论(0)
  • 2020-12-14 08:55

    I had below error:

    Error: connect ECONNREFUSED 127.0.0.1:27017
    

    In my case, this issue occurred since MongoDB is not installed at all.

    The solution was to install MongoDB from below location:
    https://www.mongodb.com/download-center/community

    After installing the ECONNREFUSED error did not appear again.

    Hope that helps.

    0 讨论(0)
  • 2020-12-14 08:55

    because you didn't start mongod process before you try starting mongo shell.

    Start mongod server

    mongod
    

    Open another terminal window

    Start mongo shell

    mongo
    
    0 讨论(0)
  • 2020-12-14 08:57

    If you are a windows user, right click on Start and open Windows Powershell(Run as administartor). Then type

    mongod
    

    That's it. Your database will surely get connected!

    0 讨论(0)
  • 2020-12-14 08:59

    You probably need to continue running your DB process (by running mongod) while running your node server.

    0 讨论(0)
提交回复
热议问题