Nodemon is not working : [nodemon] restarting due to changes

Viewed 678

I use as a dev-dependency in node. Suddenly, in CLI it shows:

[nodemon] restarting due to changes...

when I am changing the code. Then I have globally installed nodemon but it still isn't working. It is not working on any project-- not a single project.

Any help? I have attached a screenshot of my CLI:

screenshot

1 Answers

It's probably because starting updates a file that the server is watching, therefore triggering a restart event in an infinite loop.

Nodemon supports the --watch and --ignore commands. Play around with them to only watch a certain set of files. Example:

# Only watch the "server" directory
nodemon --watch server server/main.js
# Watch both the "server" and "client" directory
nodemon --watch server --watch client server/main.js
# Watch the "server" directory, but ignore "server/logs"
nodemon --watch server --ignore server/logs server/main.js
Related