-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Restarting multiple times #763
Comments
Ok something batshit insane is going on here -- I can trigger multiple restarts just by hitting return in my second terminal window (when open to the same folder).
|
Ok, it seems like this is OS X + tmux related on some level -- atleast with the terminal triggered restarts. Not sure about the actual repeated restarts on file save though. I'm using a workaround so tmux can function properly in OS X with certain services (like the sublime text CLI). @remy could this workaround be related? Here's the issue it addresses:
... What the wrapper/workaround does:
Which is run on |
@nathanmarks I thought this might be something to do with chokidar and git, but I don't see any related bugs there. With |
If you have some task runner which modifies files, it's normal for nodemon to restart multiple times because multiple files have changed. |
Yes as @tleb said, the solution is to let nodemon ignoring the folders and files which are modified by your task runner. Usually, it's the |
I would do it the other way round: watch the output directory and not the input directory because otherwise nodemon can restart before the task runner outputs the files. If the task runner is done nicely, it will only update the concerned files. If it isn't, you can add a small delay. |
@tleb I'm not using a task runner, just npm run scripts |
Not only task runners, anything that watches. Babel, a JS beautify, etc. What do your scripts do? |
@tleb Node scripts that run |
Do those scripts touch the filesystem? |
@tleb Not any folders watched by nodemon (database+redis I/O mostly). Also, there is no output directory, source = build. |
I thought I was the only one! 😦 Happening in following cases:
In short, it's reloading even on read events. I did a lot of changes over weekend, so wasn't sure what was causing this. But few things to mention, in case this is one off issue:
|
I'm experiencing this as well (on OS X). When I run I also performed another test. Without webpack and with just nodemon running, I modified the file that nodemon watches and saved it. Upon saving, nodemon will restart 3 or 4 times, listing the same file as the trigger for each restart. The strange thing is, I believe this behavior began recently. I've been using v1.9.1 since I began this particular project, and just a few days ago I began noticing this behavior. @remy, any feedback on what might be causing this and how to fix it? |
@fvargas I'm really not sure. I don't see the same thing myself (using osx, [email protected] - though pretty sure the bug fix isn't related). If you run nodemon with |
@remy I see this happening hitting save on a file -- just once. Yet that file shows up as the cause for multiple restarts. (check my verbose log in my original report) |
My results match those of @nathanmarks. The test I mentioned above involved nodemon watching a single file, which I edited and saved (using Vim), and the verbose output showed that same file as the trigger for each of the 3 or 4 restarts that would occur from that single save. Is it possible for this issue to be something that develops over time? Like I said, I don't recall observing this issue earlier on in my project. It would explain why the problem is not as widespread and not easily reproducible. |
@remy please let me know if there's anything I can do to assist in debugging this. |
OK, just reading back. I see @nathanmarks mentions tmux - is this still the case for everyone here? Have you tried the |
@remy I'm not using tmux, but the issue only occurs for me on file save. Using legacy mode seems to fix the problem. On file save, instead of restarting four times, nodemon only restarts once, as expected. Perhaps this provides a clearer idea of where the problem lies? As far as I can tell, my usage of nodemon is pretty standard, and I'm not using tmux or any container tools. This is my nodemon command without legacy mode:
Are others experiencing this issue watching a file as opposed to a directory? |
@fvargas this is very weird. So, no containers, can I ask exactly what OS? Also, is there anything special about your time on your machine? If you run |
@remy Right, no containers, and I'm running OS 10.11.4 El Capitan. The time on my machine is normal. |
@remy I was able to resolve this issue by updating the dependencies of nodemon. In particular, I believe the issue may have been with the chokidar package which also started giving me trouble when using webpack. More specifically, when using webpack, fsevents, a dependency of chokidar, began producing a warning related to some soon-to-be-deprecated functionality in node, as a result of a recent Node 6.0+ upgrade. Thus, I suspect upgrading fsevents to 1.0.12 may have also been what fixed the restarting issue with nodemon, though I can't be 100% certain. For anyone still encountering this issue, I suggest installing the latest versions of all nodemon dependencies. |
package.json {
"scripts": {
"nodemon": "nodemon index.js"
},
}
osx 10.11.3 |
What versions of Make sure |
└─┬ [email protected]
└─┬ [email protected]
└── [email protected]
|
@fourcels Upgrading Posting your Node version may help identify the issue. Based on the accounts of others and my own, this sort of issue seems to be related to |
Same here, I needed to |
@fvargas |
seems this issue is similar to the one i just opened. |
uninstalling fsevents and reinstalling seems to have fixed the issue for me |
Nothing here seems to fix it for me. OSX similar setup to the rest. I even installed nodemon locally to the project and it still starts twice on each save. This did not happen until i update to 6.2.2 this morning and the latest npm. |
I rolled back to node 5.11.1 and then uninstalled nodemon -g and reinstalled. Issue went away. |
@timmeade The symptoms you describe are consistent with the diagnosis presented throughout the latter half of this thread. Keep the following two things in mind:
I suggest setting up a new, dummy package and testing it out with the local install of nodemon as described in the readme. If it works, then we know one or both of the above two points are the cause of your problem. |
Adding "dependencies": {
"chalk": "1.1.3",
"express": "4.14.0",
"fsevents": "1.0.14",
"isomorphic-fetch": "2.2.1",
"morgan": "1.7.0",
"nodemon": "1.9.2",
"proxy-middleware": "0.15.0",
"throng": "4.0.0"
}, |
I was having the same issue while using |
|
As per #508 (comment), switching back to |
Was having the same issue. Uninstalled nodemon globally ( |
What I found is that nodemon seems to re-run gulpfile.js on each file change, instead of just running the tasks it's supposed to run from the "tasks" array parameter. |
If you are using nvm, run |
I added a |
I had this issue when upgrading to Node 7 but still with nodemon 1.9.1. Just updating to 1.11.1 fixed it. |
I have the same issue unfortunately, on Mac. I nodemon a .js file and everytime I modify it, nodemon restarts two times. Any hint? Node v7 + Nodemon 1.11.0. |
I was facing the same issue. And it had nothing to do with any specific version of So, this should be the most common(maybe only?) reason why nodemon restart multiple times. Hope it helps! ✌️ |
Running That updated the dependencies (specifically |
I had this issue because I was doing "sudo npm start" out of habit instead of simply "npm start". I don't know why, but not using sudo fixed this for me. |
For those of you using nodemon AND chokidar, only binding to
|
Going to close this issue as it looks like (reading through all the comments) that the latest nodemon fixes this as it's using the latest Happy to reopen or create a new issue if we think something is still playing up. |
@ruslankonev this is a long closed issue, but your build script is generating your components directory contents, so tell nodemon to ignore that directory |
uninstalling and installing did the trick |
Reinstall also did the trick for me. npm uninstall -g nodemon
npm install -g nodemon |
The issue started after I began using Visual Studio Code. Note that on my mac, I need to run this to see which files have been modified: |
Hey,
Posting a new issue since #508 is closed.
Refer to my last comment: #508 (comment)
...
@remy I'm on 1.8.1 and seeing this behaviour. When I hit save on a single file it is restarting multiple times.
The text was updated successfully, but these errors were encountered: