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

Error: listen EADDRINUSE :::3000 (When using subdir that includes "-" in the name) #1466

Closed
shinebayar-g opened this issue Nov 26, 2018 · 2 comments

Comments

@shinebayar-g
Copy link

shinebayar-g commented Nov 26, 2018

  • nodemon -v: 1.18.6
  • node -v: 10.13.0
  • Operating system/terminal environment: ubuntu 18.04 zsh
  • Command you ran: nodemon lesson-2/app.js

Expected behaviour

pick up changes without crash.

Actual behaviour

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

Error: listen EADDRINUSE :::3000
    at Server.setupListenHandle [as _listen2] (net.js:1286:14)
    at listenInCluster (net.js:1334:12)
    at Server.listen (net.js:1421:7)
    at Object.<anonymous> (/home/shinee/learn/nodejs/lesson-2/app.js:19:8)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
Emitted 'error' event at:
    at emitErrorNT (net.js:1313:8)
    at process._tickCallback (internal/process/next_tick.js:63:19)
    at Function.Module.runMain (internal/modules/cjs/loader.js:744:11)
    at startup (internal/bootstrap/node.js:285:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
[nodemon] app crashed - waiting for file changes before starting...

Steps to reproduce

I've actually tested few scenarios and found where is exact problem.

  • create folder named lesson-2 and create app.js file in it.
✗: cat lesson-2/app.js
const express = require('express');

const app = express();

app.use((req, res, next) => {
    res.send('<h1>Hello from Express!</h1>');
});

app.listen(3000);
  • run app.js by modifying package.json file to add script to run.
✗: cat package.json 
{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "nodemon lesson-2/app.js"
  },
  "repository": {
    "type": "",
    "url": ""
  },
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": ""
  },
  "homepage": "",
  "devDependencies": {
    "nodemon": "^1.18.6"
  },
  "dependencies": {
    "express": "^4.16.4"
  }
}

If I modify the folder name to sth like lesson2 it works like a charm and If I try lesson-2 it crashes.

@remy
Copy link
Owner

remy commented Nov 27, 2018

Pretty sure this is related to the change in #1463. I'm marking as fixed - please ping me if you see otherwise. You'll need to upgrade to nodemon@1.18.7 (currently being released).

@Mitch125
Copy link

Mitch125 commented Sep 11, 2019

This issue is present again with nodemon@1.19.2, I've reverted to 1.18.11 to fix.

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