Raz
Raz

Reputation: 1994

Nodemon restart twice when change is made

I am using nodemon in order to restart the app when change is made. It works good however it restart two times and thus sometimes it is a bit busy to read data returned from server (like console.log) since its reloaded twice.

I am talking about something like this:

[nodemon] starting `node app.js`
Connected to db and listening on port 8080
[nodemon] restarting due to changes...
[nodemon] starting `node app.js`
Connected to db and listening on port 8080

I am working with Atom IDE.

If this question is missing information, please comment and I will update in case its not fully informative.

Thank you for support.

Upvotes: 2

Views: 2867

Answers (2)

Krish Garg
Krish Garg

Reputation: 83

The solution that worked for me was adding the -L flag. nodemon -L fileName.js

Upvotes: 3

Katie Mary
Katie Mary

Reputation: 82

Possible Solution:

I would start by looking into the set of files/directories nodemon is watching. It may be currently configured to watch two different server files which is why it would restart twice for a single file change. If this is true for you, the solution is as simple as changing your config in order to manage only one extension.

Upvotes: 1

Related Questions