MongoDB setup with node.js: Error: failed to connect to [localhost:27017]

前端 未结 2 1206
萌比男神i
萌比男神i 2021-02-08 01:50

I am getting the error: \"failed to connect to [localhost:27017]\" while trying to follow this tutorial.

I\'ve been attempting to do several other node.js tutorials with

相关标签:
2条回答
  • 2021-02-08 02:19

    just start mongo server or run on mongo.exe and type

    mongod

    then

    mongo

    0 讨论(0)
  • 2021-02-08 02:31

    Just for my curiousity, can you do

    npm install mongoose
    

    and also post the output from

    ps -ef | grep mongod
    

    All on the the machine you are running node from. That would go a long way towards the rest of an answer.

    Also follow the simple sample code right after here, substitute the database name and a collection name and run that on node

    node sample.js
    

    Edit your post to include more information. It will all help.

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