MongoError: failed to connect to server [localhost:27017] on first connect

后端 未结 3 1975
一生所求
一生所求 2021-02-02 12:14

I have paid a membership and downloaded this project. After npm install and node app.js, it returns the following error:

Does anyone know what\

相关标签:
3条回答
  • 2021-02-02 12:25

    I had the same issue but it worked fine after restarting the service

    service mongod start

    0 讨论(0)
  • 2021-02-02 12:45

    Update 2020 Feb 24:

    It would be wise to stay tuned with it. Here is the link for latest library instruction:

    https://docs.mongodb.com/manual/administration/install-community/


    You haven't started your monogo database. first install mongo install mongo as per your OS https://docs.mongodb.com/v3.0/tutorial/

    then follow instructions mentioned on this site: https://docs.mongodb.com/v3.0/tutorial/getting-started-with-the-mongo-shell/

    1. cd .
    2. mongod --dbpath "any directory path to start your database "

    and then start your node server. It will work fine.

    Hope this helps!!

    0 讨论(0)
  • 2021-02-02 12:49

    First open another terminal an run command mongod to start your mongoDB

    Then again start you node server npm start or if you have "nodemon" then using nodemon

    I think now everything will be fine it will show

    Mongoose connected to mongodb://localhost/your_database
    
    0 讨论(0)
提交回复
热议问题