Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anyone knows something about this error? Thanks! #28

Open
pavazmo opened this issue Aug 16, 2017 · 3 comments
Open

Anyone knows something about this error? Thanks! #28

pavazmo opened this issue Aug 16, 2017 · 3 comments

Comments

@pavazmo
Copy link

pavazmo commented Aug 16, 2017

~/projects/tutorials/yournewapp $ node server.js
App listening on port 8080
events.js:141
throw er; // Unhandled 'error' event
^

Error: connection closed
at null. (/home/pat/projects/tutorials/yournewapp/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:592:24)
at emitNone (events.js:67:13)
at emit (events.js:166:7)
at null. (/home/pat/projects/tutorials/yournewapp/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:155:15)
at emitTwo (events.js:87:13)
at emit (events.js:172:7)
at Socket. (/home/pat/projects/tutorials/yournewapp/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:494:12)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at TCP._onclose (net.js:487:12)

@nitin-tiwari
Copy link

I get the same error, so any comments from Author will be useful.

@pavazmo
Copy link
Author

pavazmo commented Dec 20, 2017

I thought I solved it in the past. I think we got this error because there was something running in port 8080. Try clossing other node's service running and tell me :) .

ps aux | grep node

seleccion_004

@uzzal2k5
Copy link

uzzal2k5 commented Sep 26, 2018

This error shows only when , you run server.js with "node server.js " command, then the applicationn start listenning 8080 port as it is indicates into code, after that the server try to connect database (mongodb), anyhow it can't connect to the database.

if you use

hostname

rather than IP address , hostname can't resolve. or or IP port can't reach.
If you use docker container to run the application, then use docker-compose. this will help you to resolve DNS or otherwise USE direct IP address. To test database connection try following instruction -

install mongodb driver to connect using IP , PORT or hostname , post which on you use.
Suppose , If you use Ubuntu then

apt-get install mongodb

mongo -h hostname/IP -p 27017

You will be able to connect mongodb, If you have user name and password then use
mongo -u usename -p -h hostname -p 27017

Hope this will help you to resolve this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants