nodemon: nodemon 1.17.2 not working, 1.17.1 ok

  • nodemon -v: 1.17.2
  • node -v: 9.8.0
  • Operating system/terminal environment: Arch
  • Command you ran: nodemon -e ts,js,tsx,jsx,jade --inspect=9229 ./bin/www

Expected behaviour

It working

Actual behaviour

Not working

Steps to reproduce

Simply try, maybe it only on Arch linux

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 19 (5 by maintainers)

Commits related to this issue

Most upvoted comments

@gavinaiken +1 - I was trying to replicate this morning, but real/paid work took a priority. I’ll try to take another look again to work out what the right fix is.

Starting to get to the bottom of the issue. Looks like we have been using nodemon incorrectly for a long time, but it was working anyway, although not doing exactly what we thought it was doing. The recent change has broken that behaviour.

In more detail - we have always passed a glob pattern as the watch argument. Reading the README I see that it says not to do that, but to pass directories instead. i.e. we have been doing it wrong…

Our glob pattern is quite complex but I can reproduce the issue just with a simple glob pattern eg

DEBUG=nodemon* nodemon -w '../[A-Za-z]*/src' -e js,json,yml -x 'gulp mocha'

If I run that, I see a debug output line like this:

  nodemon config: dirs [ '/Users/gavin/repos/node-core' ] +47ms

where /Users/gavin/repos/node-core is the absolute path equivalent of ../ - i.e. nodemon is just ignoring the [A-Za-z]*/src part of the glob pattern. Fair enough, the docs do say not to use globs!

The change in behaviour however seems to be that in 1.17.1 all the node_modules dirs under /Users/gavin/repos/node-core are ignored. (There are several of them, and lots of module dependencies.) In 1.17.2 and .3, it is watching files in the node_modules dirs. This is despite it outputting this debug:

  nodemon ignored [ '**/.git/**',
  '**/.nyc_output/**',
  '**/.sass-cache/**',
  '**/bower_components/**',
  '**/coverage/**',
  '**/node_modules/**',

which says it will be ignoring anything in those dirs. That seems to have been broken in 1.17.2.

So I need to expand my glob pattern before passing it in to nodemon as the watch args, which I think will resolve my issue, because I will then be watching subdirs with no node_modules. But it looks like there is a bug in the latest that needs resolving to make it honor the ignores properly.