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

Created on 20 Jun 2017  路  7Comments  路  Source: typicode/json-server

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

Most helpful comment

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?

All 7 comments

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?

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

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

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

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.

killall node

Thanks! @markstrefford, problem solved.

Was this page helpful?
0 / 5 - 0 ratings