ECONNREFUSED error
There are few reasons of this error in node :
-
Your port is already serving some service so it will refuse your connection.
go to command line and get pid by using following command
$ lsof -i:port_number
Now kill pid by using
$ kill -9 pid(which you will get by above command)
-
Your server is not running e.g. in this case please check your mongoose server is running or run by using following command.
$ mongod
-
There is also possibility your
localhost
is not configured properly so use127.0.0.1:27017
instead of localhost.