json-server icon indicating copy to clipboard operation
json-server copied to clipboard

error execution events.js:182 throw er; // Unhandled 'error' event

Open webmobiles opened this issue 9 years ago • 7 comments

my db.json { "users": [ { "id": 1, "firstname": "a1", "lastname": "A1" }, { "id": 2, "firstname": "a2", "lastname": "A2" }, { "id": 3, "firstname": "a3", "lastname": "A3" } ], "posts": [ { "id": 1, "title": "json-server", "author": "typicode" } ], "comments": [ { "id": 1, "body": "some comment", "postId": 1 } ], "profile": { "name": "typicode" } }

$ json-server --watch db.json

{^_^}/ hi!

Loading db.json Done

Resources http://localhost:3000/users http://localhost:3000/posts http://localhost:3000/comments http://localhost:3000/profile

Home http://localhost:3000

Type s + enter at any time to create a snapshot of the database Watching...

events.js:182 throw er; // Unhandled 'error' event ^

Error: listen EADDRINUSE 0.0.0.0:3000 at Object.exports._errnoException (util.js:1014:11) at exports._exceptionWithHostPort (util.js:1037:20) at Server.setupListenHandle [as _listen2] (net.js:1307:14) at listenInCluster (net.js:1355:12) at doListen (net.js:1481:7) at _combinedTickCallback (internal/process/next_tick.js:105:11) at process._tickCallback (internal/process/next_tick.js:161:9) at Function.Module.runMain (module.js:607:11) at startup (bootstrap_node.js:158:16) at bootstrap_node.js:575:3

webmobiles avatar Jun 20 '17 16:06 webmobiles

The problem here is Error: listen EADDRINUSE 0.0.0.0:3000 You already have a process connected to port 3000, so do you have another node.js service running?

markstrefford avatar Jul 08 '17 22:07 markstrefford

yes; you are right, was another service in that port , was nice if the error is an english phrase

webmobiles avatar Jul 09 '17 06:07 webmobiles

hmm, @markstrefford instead of using another port, how can I do if I have to use the original port number? At the above example, I'm gonna use port 3000. In this case, how can I manage this problem?

Thanks, Alex

ghost avatar Aug 30 '17 11:08 ghost

thanks @markstrefford , i was too facing the same problem and your suggestion helped me in resolving it.

beingbing avatar Sep 20 '17 18:09 beingbing

the same error occurred in my program, how can I fix it? I try it changing the port number, but not solved. Please anyone tell me.

vvp45 avatar Nov 28 '17 15:11 vvp45

killall node

blackchalk avatar Jan 14 '18 19:01 blackchalk

Thanks! @markstrefford, problem solved.

pepop99 avatar Jul 07 '18 12:07 pepop99