Search code examples
javascriptnode.jsexpressservernodemon

"[nodemon] app crashed - waiting for file changes" - I'm completely stumped


This is actually part of a training exercise, but I'm sure I'll need it for a Capstone project I'm working on. I've tried a couple of things, but a lot of what I looked up is confusing to me. Does anyone know of a simple way to fix this?...

My index.js code.

I've tried killing the server elsewhere and checking if I installed Express erroneously. I double-checked to make sure my files were saved and in proper syntax. Nothing changed. Some of the solutions I looked up were hard to follow, and I didn't want to risk messing up my files using the wrong thing.

The error in question is "listen EADDRINUSE: address already in use ::: 5000."


Solution

  • The error message is telling you the address your server is trying to listen to is already in use EADDRINUSE: address already in use :::5000, probably you have another instance from a previous test running?

    To test, try changing the port your server is listening to. Modify the line:

    var server = app.listen(5000, function () {
    

    to

    var server = app.listen(5001, function () {