Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nodemon and Redwood-Broker

I am running Nodemon in an express app, and I've done no special configuration; in my package.json I have this:

"scripts": {
  "start:dev": "nodemon app/app.js"
}
...

Everything goes fine until I make changes, and Nodemon goes to restart. I get an EADDRINUSE error, so I'll try and restart completely and I get the same error.

After this, I started checking for anything running on port 3001 (which is what Nodemon is supposed to run on), and get something like the following output:

$ lsof -i :3001
COMMAND   PID    USER         FD   TYPE             DEVICE SIZE/OFF NODE NAME
node    54343    myUserName   11u  IPv6 0x1bdae98886f3261d      0t0  TCP *:redwood-broker (LISTEN)

If I kill that process, I can finally restart Nodemon, but the same thing will happen the next time I make changes to the files being watched by Nodemon.

After scouring the Internet, I've seen some mentions of redwood-broker, but nothing helpful so far. Has anyone seen this behavior with Nodemon?

I'm using the following:

Express 4.16.2

Nodemon version 1.15.1

2016 MacBook Pro with Sierra 10.12.6

Any help is greatly appreciated!

like image 915
hhoburg Avatar asked Mar 22 '18 22:03

hhoburg


People also ask

What is nodemon in NPM?

Nodemon is a utility that will monitor for any changes in your source and automatically restart your server. Perfect for development. Install it using npm. Just use nodemoninstead of nodeto run your code, and now your process will automatically restart when your code changes.

What is nodemon reload?

nodemon reload, automatically. Nodemon is a utility depended on by over 1.5 million projects, that will monitor for any changes in your source and automatically restart your server.

What are the benefits of using nodemon?

Nodemon does not require any change in the original code and method of development. It is easy to use and easy to get started. It does not affect the original code and no instance require to call it.

Is it better to use nodemon or concurrently with expressjs?

I'm using ExpressJS, nodemon and concurrently. After removing concurrently from the node stack, ExpressJS is loading up ok, 60-70% of the time it manages to end the process before restarting again (nodemon). It's probably better than killing node itself.


1 Answers

This issue happens to a few people. You could do below to try:

Option 1:

sudo pkill node

Option 2:

  1. sudo lsof -i :5955

Then kill the process which is currently running on the port using its PID

  1. sudo kill -9 PID

Hope it helps

like image 142
Anh Tran Avatar answered Oct 20 '22 16:10

Anh Tran