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

前端 未结 2 1209
萌比男神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: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.

提交回复
热议问题