Nodemon: Nodemon stuck at restarting

Created on 5 Apr 2016  Â·  22Comments  Â·  Source: remy/nodemon

Nodemon detects file change, attempts to restart the server, but takes forever long to restart - stuck at restarting the server and the server never restarts unless stopped manually.

Infact, whenever I Ctrl+s save a file WITHOUT making any changes, the message appears "restarting due to changes...", and stays there, never restarts. Please help

Also, when I enter rs, nothing happens.
Also, it never states "listening on port 3000", but the page responds in browser. (Following is the cmd snapshot):

nodemon

OS: Windows 10
Node version 4.4.2
npm version 2.15.0
nodemon version 1.9.1

Most helpful comment

Hi!

I do have the same issue, with windows 10, when I make a change it says "restarting ..." but doesn't restart the server, see snapshot

nodemon

All 22 comments

Same issue just wanted to give my 2 cents(workaround below)
uninstalling and reinstalling fsevents seems to work for many people running node >= v5

I've been using node 4.4.3 for a while and just upgraded to El Capitan. Seems to be a race condition with the way OSX files are being watched through nodemon -> chokidar -> fsevents. Also experienced this with a later version of Yosemite. Would get infinite restarts as many of these other issues have stated until i reinstalled/rebuilt chokidar with a lower version of itself and fsevents.

Then, i would still have the issue in my production app due to a frontend .js file that we build on app startup/save (we concatenate everything into one file for the client via node fs vs. using a task runner or webpack, etc.)

So I ran nodemon with --verbose and sure enough, the race condition would still persist with fsevents and chokidar rebuilt/downversioned, so the only workaround was to either add these implicitly to the nodemon --ignore list, or to run the app with -C (on-change-only) preventing a file-change restart on app boot and persisting nodemon to reboot/watch on actual changes to file vs. startup.

Going to look into this more for older node version users, but wanted to give my 2 cents for those still struggling after rebuilding fsevents/chokidar.

Had exact same issue, installing updates and restarting my laptop solved it.

This issue has been automatically marked as idle and stale because it hasn't had any recent activity. It will be automtically closed if no further activity occurs. If you think this is wrong, or the problem still persists, just pop a reply in the comments and @remy will (try!) to follow up.
Thank you for contributing <3

I can reproduce it with nodemon 1.12.5

$ node --version
v6.12.0
$ npm --version
3.10.10

As you can see from the logs, it starts up fine, then does my normal setup and logs some line to show that it's started up. I then make a change and nodemon says it's restarting, but it actually doesn't restart, the app still responds. If I make another change after a couple seconds, again nodemon says it's restarting, but actually isn't.

[nodemon] 1.12.5
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `ts-node ./src/index.ts`
Setting up server on port: 3002
Server started
[nodemon] restarting due to changes...
[nodemon] restarting due to changes...

I also created a small test to make sure nodemon really doesn't make the restart happen.

[nodemon] 1.12.5
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `ts-node ./src/index.ts`
Setting up server on port: 3002
Server started
Been Running for 0 seconds
Been Running for 1 seconds
Been Running for 2 seconds
Been Running for 3 seconds
Been Running for 4 seconds
Been Running for 5 seconds
[nodemon] restarting due to changes...
Been Running for 6 seconds
Been Running for 7 seconds
Been Running for 8 seconds
Been Running for 9 seconds
Been Running for 10 seconds
Been Running for 11 seconds
[nodemon] restarting due to changes...
Been Running for 12 seconds
Been Running for 13 seconds
Been Running for 14 seconds
Been Running for 15 seconds

So nodemon obviously understands that the files have changed, but it doesn't restart the process properly. Running with -C didn't make a difference in my case.

Running with --verbose, the logs are:

[nodemon] Looking in package.json for nodemonConfig
[nodemon] 1.12.5
[nodemon] reading config /opt/packages/package/package.json
[nodemon] to restart at any time, enter `rs`
[nodemon] ignoring: .git .nyc_output .sass-cache bower_components coverage /opt/packages/package/node_modules/**/*
[nodemon] watching: *.*
[nodemon] watching extensions: ts,json
[nodemon] starting `ts-node ./src/index.ts`
[nodemon] child pid: 28
[nodemon] watching 68 files
Setting up server on port: 3002
Server started
Been Running for 0 seconds
Been Running for 1 seconds
Been Running for 2 seconds
Been Running for 3 seconds
Been Running for 4 seconds
[nodemon] files triggering change check: src/database/repository.ts
[nodemon] matched rule: **/*.*
[nodemon] changes after filters (before/after): 1/1
[nodemon] restarting due to changes...
[nodemon] src/database/repository.ts

Been Running for 5 seconds
Been Running for 6 seconds
Been Running for 7 seconds
Been Running for 8 seconds
Been Running for 9 seconds
Been Running for 10 seconds

If there's any additional info I can give to help reproduce this, I'm happy to answer any questions.

This is great, thank you. I'm not familiar with typescript, and if you can
provide a gist (or repo if necessary) with the src/index.ts and
typescript version you're running so I can replicate locally, I can try to
debug to see why it's lingering.

Also, what OS are you running?

On Wed, 6 Dec 2017, 06:02 Siim Talvik, notifications@github.com wrote:

I can reproduce it with nodemon 1.12.5

$ node --version
v6.12.0
$ npm --version
3.10.10

As you can see from the logs, it starts up fine, then does my normal setup
and logs some line to show that it's started up. I then make a change and
nodemon says it's restarting, but it actually doesn't restart, the app
still responds. If I make another change after a couple seconds, again
nodemon says it's restarting, but actually isn't.

[nodemon] 1.12.5
[nodemon] to restart at any time, enter rs
[nodemon] watching: .
[nodemon] starting ts-node ./src/index.ts
Setting up server on port: 3002
Server started
[nodemon] restarting due to changes...
[nodemon] restarting due to changes...

I also created a small test to make sure nodemon really doesn't make the
restart happen.

[nodemon] 1.12.5
[nodemon] to restart at any time, enter rs
[nodemon] watching: .
[nodemon] starting ts-node ./src/index.ts
Setting up server on port: 3002
Server started
Been Running for 0 seconds
Been Running for 1 seconds
Been Running for 2 seconds
Been Running for 3 seconds
Been Running for 4 seconds
Been Running for 5 seconds
[nodemon] restarting due to changes...
Been Running for 6 seconds
Been Running for 7 seconds
Been Running for 8 seconds
Been Running for 9 seconds
Been Running for 10 seconds
Been Running for 11 seconds
[nodemon] restarting due to changes...
Been Running for 12 seconds
Been Running for 13 seconds
Been Running for 14 seconds
Been Running for 15 seconds

So nodemon obviously understands that the files have changed, but it
doesn't restart the process properly.

If there's any info I can give to help reproduce this, I'm happy to answer
any questions.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/remy/nodemon/issues/813#issuecomment-349544118, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAA1hOdw3k4IImZGeN8opKSX1CcuZDIKks5s9i4JgaJpZM4IAWAc
.

I'm on Debian Stretch (9)
I've made a simplified sample that mimics my setup and shows the issue here: https://github.com/simpss/nodemon-issue-813-repro

Some instructions are included in the readme. If you have any questions, let me know.

@simpss thanks for this. Do you have any tips on how I can develop against this too - or just hack directly inside the node_modules directory? (sorry, I always find the docker dev process a little tricky)

I've added start-mounted.sh as an example.
If you open it up, you'll see there's a --mount parameter with options source and target. You can mount any host directory to the container.
So to pass a host src dir to the container you'd do:

--mount type=bind,source=/full/host/path/to/packages/package/src,target=/opt/packages/package/src

and to have a host node_modules/nodemon directory inside the container you can do:

--mount type=bind,source=/full/host/path/to/packages/package/node_modules/nodemon,target=/opt/packages/package/node_modules/nodemon

Edit:
Or you can just run ./attach.sh this will take you to the container terminal and you'll be in the npm package directory where you can change files with vim.
So to hack inside node_modules/nodemon you'd just run vim node_modules/nodemon/README.md in the container terminal.

Edit2:
I also made sure that the local nodemon is used, instead of the globally installed version with the latest commit: https://github.com/simpss/nodemon-issue-813-repro/commit/35a0c73842b24565fda5fa01778a4ae300df03bc#diff-bb412f257d3f625819bfbfb129eb9b37R9

@simpss I've been testing this out more and I'm pretty certain the issue is between nodemon the Docker build (debian:stretch) and the kill command found here

I don't really know enough about what goes on under the hood with processes and kill signals, but I need to add a local change that will echo out that the kill command ran the callback, but I'm 90% sure it's failing.


I've just run another test, and when the Dockerfile includes procps in the apt-get install the restart works.

As I understand, It's failing because kill command doesn't exist on the minimal system and can be worked around by installing procps.

From my point of view if there's no way to kill a process without the kill command. It would be enough to handle the failure and just log it out as a warning.

Something like: "'kill: command not found', do you have procps installed?"

I've dug a lot deeper and found the root cause now.

It's basically this: https://nodejs.org/dist/latest-v8.x/docs/api/child_process.html#child_process_subprocess_kill_signal (read from "Also note: on Linux").

I've got a working solution that I'm merging into nodemon right now: https://github.com/remy/pstree

Hi!

I do have the same issue, with windows 10, when I make a change it says "restarting ..." but doesn't restart the server, see snapshot

nodemon

Hi Ramy!
Nodemon still cannot start automatically.

  • [nodemon] 1.17.1
  • [nodemon] to restart at any time, enter rs
  • [nodemon] watching: .
  • [nodemon] starting node app.js
  • Slm Blue, server tarafından dinlenilen port : 3000
  • [nodemon] restarting due to changes...

`

You'll need to raise a new issue if you're experiencing problems (as this original issue was raised 48 months ago and the code has long changed).

[nodemon] 1.17.2
[nodemon] to restart at any time, enter rs
[nodemon] watching: .
[nodemon] starting node app.js
app run on lacolhost
[nodemon] restarting due to changes...
rs
I have same issue on win 10 'rs' command without any response

I'm also having the same issue with windows 7 and nodemon 1.17.3

can someone please put a solution for that!

This maybe one of modules (one suspect is node-java) capturing the SIGUSR2 signal and not stopping the app.

I solved it by following a tip from https://github.com/remy/nodemon/issues/573

Tell Nodemon to use different signal for restarting the app, for example

nodemon --signal SIGINT app.js

Started to have this issue recently on Windows 10 platform.
Uninstalling and re-Installing the latest nodemon doesn't help.
Running nodemon in legacy mode helps, but better to have a native fix.

> nodemon -v 1.17.5

> node -v v8.11.2

> npm -v 6.0.1

Same issue here, driving me crazy, just started out of no where.. Not specific to any project, just the environment. I think it started after some environment path variable changes, is this possible?

EDIT: Yes it was because I deleted some path.... So I would bet this is probably the #1 cause... Since I restarted the computer since, I couldnt recover it from the registry and had to re-install windows. Fixed the issue.

Why this closed? problem persists on last version: 1.18.10

I was using a Windows 7 and had this problem.

After looking at the environment variables, I notice that was missing some PATH variables

To force it (maybe you don't need all of this) I place this variables there

C:\Windows;C:\Windows\system32;C:\Windows\System32\Wbem;

Same problem with ndoemon 2.0.6, I have to press enter button on keyboard , then it will continue to restart.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Autre31415 picture Autre31415  Â·  4Comments

endquote picture endquote  Â·  4Comments

dimsmol picture dimsmol  Â·  4Comments

jagged3dge picture jagged3dge  Â·  4Comments

fabianMendez picture fabianMendez  Â·  4Comments