nodemon: Nodemon does not reload on --watch folder only on the app file

  • nodemon -v: 1.18.10
  • node -v: 10.8.0
  • Operating system/terminal environment: MacOS, bash command
  • Using Docker? What image: No
  • Command you ran: nodemon --watch ./build/dist --watch ./build/dist/graphql/schemas build/dist/index.js -V

Expected behavior

To have NodeJS restart.

Actual behavior

It detects the folder has a file that has changed but does not restart.

Steps to reproduce

  1. NPM script:
"watchgraphql": "cpx 'src/graphql/schemas/**/*.graphql' build/dist/graphql/schemas/ -w -v",
"dev": "concurrently \"tsc -w\" \"npm run watchgraphql\" \"nodemon --watch ./build/dist --watch ./build/dist/graphql/schemas build/dist/index.js -V\"",
  1. Run the script
npm run dev

This check for TypeScript file, when something is saved, transpile and save the JS. This change the index.js thus node is restarting as expected. However, if I change a .graphql file, the watchgraphql copy the file (as expected) and nodemon detect the change (see the verbose output) but node does not restart.

Verbose output:

[1] Copied: src/graphql/schemas/ocadmin/org.graphql --> build/dist/graphql/schemas/ocadmin/org.graphql [2] [nodemon] files triggering change check: build/dist/graphql/schemas/ocadmin/org.graphql [2] [nodemon] matched rule: /Users/pdesjardins/code/ocgraphqlserver/build/dist/graphql/schemas//* [2] [nodemon] changes after filters (before/after): 1/0 [2] [nodemon] files triggering change check: build/dist/graphql/schemas/ocadmin/org.graphql [2] [nodemon] matched rule: /Users/pdesjardins/code/ocgraphqlserver/build/dist/graphql/schemas//* [2] [nodemon] changes after filters (before/after): 1/0 [2] [nodemon] files triggering change check: build/dist/graphql/schemas/ocadmin/org.graphql [2] [nodemon] matched rule: /Users/pdesjardins/code/ocgraphqlserver/build/dist/graphql/schemas/**/* [2] [nodemon] changes after filters (before/after): 1/0

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 21 (7 by maintainers)

Commits related to this issue

Most upvoted comments

for those still struggling with nodemon + ts files, im using nodemon 1.19.4, and created this configuration file:

{
  "verbose": true,
  "ext": "ts, js, jsx, tsx, json",
  "ignore": [
    ".git",
    "node_modules/**/node_modules"
  ],
  "events": {
    "restart": "npm run lint; echo '\nRecompiling...\n'; npm run compile; echo '\nReady!\n'"
  },
  "watch": [
    "src"
  ],
  "env": {
    "NODE_ENV": "development"
  }
}

It’s more that I’m not super keen on spending time getting wound up by your reply during the weekend (or the weekdays if I’m honest).

Anyway, from what I’ve determined from your latest comment on the issue, is that in your particular situation, you think it’s hard to solve, so you don’t (I’m guessing) want to try to debug and fix (understandably because it’s hard to debug and get tests passing and to actually ensure the original issue has been addressed in a way you can confirm - this is frustratingly a unique aspect of nodemon).

Which is probably the same reason no one else has ever taken a shot at it (you mention this has been raised again and again).

But sure, it’s left to me. I’ll attack this issue when it affects me. During my day to day dev I’ve not encountered this (because my workflow is different), but the day it’s a problem, I’ll consider (and likely) raise a PR against nodemon to get it fixed.

Of course, again, if there’s a PR for this, you all guessed right, I’ll happily merge.

Goodnight folks. Going back my family. Have a good (or better) weekend.

On Sat, 28 Sep 2019, 18:42 David Nunez, notifications@github.com wrote:

Yeah it’s 2019: if there’s more than two paragraphs and no TLDR; section then it doesn’t get read. I doubt it’s because it’s written in a way that is hard to follow though.

Since this isn’t the first, second or even third nodemon thread related to this issue (and the second that’s gotten closed by stalebot despite multiple “here here! That’s happening to me too. Anyone know why?”) changing the stalebot threshold would probably help.

In my case, I think the issue was harder to solve because there were orphaned nodejs file watches triggered by nodemon in the day(s) prior, and I’m not sure why. Not a likely issue to occur for machines that get shutdown and restarted daily, but for an “always up” Linux server that I’m SSH’ing into, non-graceful shutdowns can cause weird side effects after days of continuous use.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/remy/nodemon/issues/1528?email_source=notifications&email_token=AAADLBGSCPEOSYZC4WP2RHTQL6JR7A5CNFSM4GXSQ4A2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD726WQQ#issuecomment-536210242, or mute the thread https://github.com/notifications/unsubscribe-auth/AAADLBBFC3GKZ3XG3OQFF4DQL6JR7ANCNFSM4GXSQ4AQ .