question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

EADDRINUSE in 2.0.12 version

See original GitHub issue

Nodemon version 2.0.12 run nodemon after change or rs i have error: Error: listen EADDRINUSE: address already in use :::3007

`events.js:291 throw er; // Unhandled ‘error’ event ^

Error: listen EADDRINUSE: address already in use :::3007 at Server.setupListenHandle [as _listen2] (net.js:1316:16) at listenInCluster (net.js:1364:12) at Server.listen (net.js:1450:7) at Object.<anonymous> (C:\Users\Nikiforov.Evgeny\Documents\projects\passport\bin\app.js:35:15) at Module._compile (internal/modules/cjs/loader.js:1256:30) at Object.Module._extensions…js (internal/modules/cjs/loader.js:1277:10) at Module.load (internal/modules/cjs/loader.js:1105:32) at Function.Module._load (internal/modules/cjs/loader.js:967:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) at internal/main/run_main_module.js:17:47 Emitted ‘error’ event on Server instance at: at emitErrorNT (net.js:1343:8) at processTicksAndRejections (internal/process/task_queues.js:80:21) { code: ‘EADDRINUSE’, errno: -4091, syscall: ‘listen’, address: ‘::’, port: 3007 } `

When i rollback to version 2.0.7 - i have no errors.

Setps to reproduce:

app.js:

import express from 'express';
const server = express();

server.use(express.urlencoded({ extended: true }));
server.use(express.json());

server.listen(3007, () => {
    console.info(
        'Listening on http://localhost\nOpen http://localhost/v1/api-docs for documentation'
    );
});

package.json:

{
  "name": "nodemontest",
  "version": "1.0.0",
  "description": "test nodemon error eaddrinuse",
  "main": "app.js",
  "license": "MIT",
  "type": "module",
  "dependencies": {
    "express": "^4.17.1"
  },
  "devDependencies": {
    "nodemon": "^2.0.7"
  },
  "scripts": {
    "server": "node ./src/app.js",
    "watch": "nodemon"
  }
}

nodemon.json:

{ 
    "watch": ["src/*"],
    "ext": "js, json, yaml",
    "exec": "yarn server"
}
  1. yarn watch
  2. wait while server run
  3. type rs and press enter or add some comment to app.js

I have Node.js v14.7.0. Windows 10 Version 1903 (Build 18362.239) Powershell version 5.1.18362.145

The usual windows command line (cmd.exe) has the same error. It looks like it’s not about the terminal.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:37 (15 by maintainers)

github_iconTop GitHub Comments

5reactions
levirs565commented, Jul 20, 2021

You can fix this issue by downgrading nodemon to version 2.0.7.

4reactions
remycommented, Jul 27, 2021

@remy Yes, removing “exec” prop does work in the minimalistic example. What if we need more complex “exec” command though? For example we want to add -r dotenv/config.

You can pass -r directly to nodemon, but that’s not the point - now I know where to look for the issue and how to confirm any fixes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nodemon: Error: listen EADDRINUSE: address already in use
I am using version 2.0.12 and facing the same problem. A fix was implemented in 2.0.14 and upgrading to this version corrected the...
Read more >
Web app startup error: listen EADDRINUSE - Troubleshooting
It is the first time I use cryosparc, and it seems installed successfully. However, It cannot open in web when I start cryosparc....
Read more >
The Node.js Handbook - The Valley of Code
2019 2.0.12. ... Update all the Node dependencies to their latest version ... sets the constants for error reporting, like EADDRINUSE, EOVERFLOW and...
Read more >
Error: Listen Eaddrinuse When Using Nodemon With Babel 7
It means that something is running on port 3000 already.You need to stop that and then start your application.Or just change the port...
Read more >
How to kill server when seeing “EADDRINUSE: address ...
A tutorial on how to kill the process manually when “EADDRINUSE” happens on Mac/Linux and Windows. Nodejs listen EADDRINUSE: address already in ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found