Skip to content
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

Can nodemon watch and restart on changes occurring to files with no extension? #461

Closed
gizero opened this issue Jan 13, 2015 · 9 comments · Fixed by dailybruin/sources#16 · May be fixed by mjohnson9/twitch-markov-bot#78 or chauncey-garrett/dotfiles#60

Comments

@gizero
Copy link

gizero commented Jan 13, 2015

I'm using express-generator from Express.js (>4.0). As already discussed in #330, it sets things up to run the app with node ./bin/www. How should I setup nodemon in order to trigger restarts on changes to ./bin/www.

$ DEBUG=test nodemon --verbose ./bin/www
13 Jan 16:41:47 - [nodemon] v1.2.1
13 Jan 16:41:47 - [nodemon] to restart at any time, enter `rs`
13 Jan 16:41:47 - [nodemon] ignoring: .git /tmp/test/node_modules/**/* bower_components .sass-cache
13 Jan 16:41:47 - [nodemon] watching: *.*
13 Jan 16:41:47 - [nodemon] watching extensions: js
13 Jan 16:41:47 - [nodemon] starting `node ./bin/www`
13 Jan 16:41:47 - [nodemon] child pid: 1516
13 Jan 16:41:47 - [nodemon] watching 806 files

When changing the file:

13 Jan 16:41:52 - [nodemon] files triggering change check: bin/www
13 Jan 16:41:52 - [nodemon] changes after filters (before/after): 1/0

I tryed to explicitly add the file to the watchlist with the following cmdline, but looks like it still get filtered out.

$ DEBUG=test nodemon -w ./bin/www --verbose ./bin/www
@remy
Copy link
Owner

remy commented Jan 14, 2015

:-\

Hmm. That's weird. I'll have to run some tests myself. I suspect you're right, it if can't find an extension it might be lost. But because you've explicitly added it should be watched.

Can you run: nodemon -w ./bin/www --verbose ./bin/www --dump and post the result?

@remy remy added the needs more info not enough information in issue to debug label Jan 14, 2015
@gizero
Copy link
Author

gizero commented Jan 15, 2015

Here is the dump...

$ nodemon -w ./bin/www --verbose ./bin/www --dump                                                                                      [ruby-2.0.0-p195]
15 Jan 08:26:12 - [nodemon] v1.2.1
15 Jan 08:26:12 - [nodemon] to restart at any time, enter `rs`
15 Jan 08:26:12 - [nodemon] ignoring: .git /tmp/provetta/node_modules/**/* bower_components .sass-cache
15 Jan 08:26:12 - [nodemon] watching: ./bin/www
15 Jan 08:26:12 - [nodemon] watching extensions: js
--------------
node: v0.10.35
nodemon: v1.2.1
command: node /home/gizero/.nvm/v0.10.35/bin/nodemon -w ./bin/www --verbose ./bin/www --dump
cwd: /tmp/provetta
OS: linux ia32
--------------
{ run: false,
  system:
   { cwd: '/tmp/provetta',
     useFind: false,
     useWatch: true,
     useWatchFile: false },
  required: false,
  dirs: [ '/tmp/provetta' ],
  timeout: 1000,
  options:
   { scriptPosition: 0,
     watch: [ './bin/www', re: /\./bin/www/ ],
     verbose: true,
     dump: true,
     script: './bin/www',
     args: [],
     ignore:
      [ '.git',
        'node_modules',
        'bower_components',
        '.sass-cache',
        re: /\.git|node_modules|bower_components|\.sass\-cache/ ],
     restartable: 'rs',
     execMap: { py: 'python', rb: 'ruby' },
     stdin: true,
     stdout: true,
     execOptions:
      { script: './bin/www',
        exec: 'node',
        args: [],
        nodeArgs: undefined,
        ext: 'js',
        env: {},
        execArgs: [] },
     ext: 'js',
     monitor:
      [ './bin/www',
        '!.git',
        '!/tmp/provetta/node_modules/**/*',
        '!bower_components',
        '!.sass-cache' ] },
  load: [Function],
  reset: [Function: reset],
  lastStarted: 0,
  loaded: [],
  command:
   { raw: { executable: 'node', args: [ './bin/www' ] },
     string: 'node ./bin/www' } }
--------------
15 Jan 08:26:12 - [nodemon] exiting

@gizero
Copy link
Author

gizero commented Jan 27, 2015

Hi! Did the dump help figuring out what's wrong with monitoring extension-less files? Let me know if I can help with more testing...

@remy
Copy link
Owner

remy commented Jan 27, 2015

I'm back from holiday today, so I'll be checking it out - I'll let you know
if I need any other information.
On 27 Jan 2015 06:15, "gizero" notifications@github.com wrote:

Hi! Did the dump help figuring out what's wrong with monitoring
extension-less files? Let me know if I can help with more testing...


Reply to this email directly or view it on GitHub
#461 (comment).

@remy
Copy link
Owner

remy commented Jan 28, 2015

Huh. This is weird. I replicated your issue, but then I tried this (which is missing the leading ./ in the watch):

DEBUG=test nodemon -w bin/www --verbose ./bin/www

And it works...

Are you happy with that as a work around or do you want me to dig deeper?

@remy remy added bug specific to test case and removed needs more info not enough information in issue to debug labels Jan 28, 2015
@gizero
Copy link
Author

gizero commented Feb 7, 2015

Hi! What you say about removing the leading ./ is confirmed here, but did you then try to change or touch any file other than bin/www? In my test, with your same exact command line, saving any *.js does end up in no script restart anymore. It's probably my fault in grasping the correct use of -w option, but I thought it was supposed to add elements to the default watchlist... Isn't it the case? Thanks for investigating.

@kevinSuttle
Copy link

Found this on my own as well. @remy since this is part of the Express scaffold, would it be wise to whitelist?

@SoilChang
Copy link

I ran into the problem myself today. My solution is using -e here in the script. it works after that. But a bit verbose if you want to watch several types of files.

@rmariuzzo
Copy link

rmariuzzo commented Nov 23, 2017

This happened to me as well. The full comand is:

yarn serve
yarn serve v0.24.6
$ cross-env NODE_ENV=development DEBUG=foo:* nodemon --verbose --watch ./src/server/server.js --watch ./src/server/dev.js

When I edit and save changes to any of those two files, nodemon doesn't restarts:

[nodemon] files triggering change check: src/server/server.js
[nodemon] changes after filters (before/after): 1/0

remy added a commit that referenced this issue Dec 14, 2017
Fixes the issue where express is a js based project, but the executable
is `www`, so it misses on the match. So now nodemon will watch for
matching extensions but *also* the script the user gave.

Fixes #461

Note that this can't handle the situation where npm is used to run `node
./bin/www` as nodemon can't split out a package script command.
remy added a commit that referenced this issue Dec 15, 2017
Fixes the issue where express is a js based project, but the executable
is `www`, so it misses on the match. So now nodemon will watch for
matching extensions but *also* the script the user gave.

Fixes #461

Note that this can't handle the situation where npm is used to run `node
./bin/www` as nodemon can't split out a package script command.
jimthedev pushed a commit to commitizen/cz-cli that referenced this issue May 24, 2018
This Pull Request updates dependency [nodemon](https://github.com/remy/nodemon) from `v1.11.0` to `v1.17.5`



<details>
<summary>Release Notes</summary>

### [`v1.17.5`](https://github.com/remy/nodemon/releases/v1.17.5)
[Compare Source](remy/nodemon@ff79835...v1.17.5)
##### Bug Fixes

* in watch, use fully filtered ignore rules ([b3fc3a9](remy/nodemon@b3fc3a9)), closes [#&#8203;1348](`remy/nodemon#1348)

---

### [`v1.17.4`](https://github.com/remy/nodemon/releases/v1.17.4)
[Compare Source](remy/nodemon@6925494...v1.17.4)
##### Bug Fixes

* {{filename}} is only replaced once ([f616258](remy/nodemon@f616258))
* increase perf of watching large file count ([58b82f2](remy/nodemon@58b82f2)), closes [#&#8203;1317](`remy/nodemon#1317)
* only hook SIGINT on boot - not at require ([9bbc219](remy/nodemon@9bbc219)), closes [#&#8203;1326](`remy/nodemon#1326)
* support env.SUPPRESS_SUPPORT ([#&#8203;1334](`remy/nodemon#1334)) ([ee2aac1](remy/nodemon@ee2aac1))

---

### [`v1.17.3`](https://github.com/remy/nodemon/releases/v1.17.3)
[Compare Source](remy/nodemon@v1.17.2...v1.17.3)
##### Bug Fixes

* don't throw when required in the repl ([aa18c80](remy/nodemon@aa18c80)), closes [#&#8203;1292](`remy/nodemon#1292)

---

### [`v1.17.2`](https://github.com/remy/nodemon/releases/v1.17.2)
[Compare Source](remy/nodemon@v1.17.1...v1.17.2)
##### Bug Fixes

* prevent throw when args missing ([#&#8203;1288](`remy/nodemon#1288)) ([89d6062](remy/nodemon@89d6062)), closes [#&#8203;1286](`remy/nodemon#1286)
* watch count regression ([#&#8203;1287](`remy/nodemon#1287)) ([372e6b2](remy/nodemon@372e6b2)), closes [#&#8203;1283](`remy/nodemon#1283)

---

### [`v1.17.1`](https://github.com/remy/nodemon/releases/v1.17.1)
[Compare Source](remy/nodemon@v1.17.0...v1.17.1)
##### Bug Fixes

* throwing exeception on run ([85ed19d](remy/nodemon@85ed19d)), closes [#&#8203;1276](`remy/nodemon#1276)

---

### [`v1.17.0`](https://github.com/remy/nodemon/releases/v1.17.0)
[Compare Source](remy/nodemon@v1.16.1...v1.17.0)
##### Bug Fixes

* make it possible for windows to checkout ([#&#8203;1270](`remy/nodemon#1270)) ([0f39b2e](remy/nodemon@0f39b2e)), closes [#&#8203;1255](`remy/nodemon#1255)
* windows exec resolution ([#&#8203;1274](`remy/nodemon#1274)) ([7ffd545](remy/nodemon@7ffd545)), closes [#&#8203;1251](`remy/nodemon#1251)
* make clear where more opts are in help ([#&#8203;1271](`remy/nodemon#1271)) ([f4391d4](remy/nodemon@f4391d4))
* put windows drive letter tweak in right place ([#&#8203;1272](`remy/nodemon#1272)) ([94b526f](remy/nodemon@94b526f)), closes [#&#8203;1263](`remy/nodemon#1263)
##### Features

* try to resolve exec in node_modules/.bin ([#&#8203;1275](`remy/nodemon#1275)) ([7fb365d](remy/nodemon@7fb365d)), closes [#&#8203;1268](`remy/nodemon#1268)
* feed args to exec when detecting script ([#&#8203;1273](`remy/nodemon#1273)) ([e41f3c3](remy/nodemon@e41f3c3)), closes [#&#8203;1263](`remy/nodemon#1263)

_Note: due to an oddity in the automated build process, nodemon was bumped two minor versions instead of one. Nothing to worry about though._

---

### [`v1.16.1`](remy/nodemon@v1.16.0...v1.16.1)
[Compare Source](remy/nodemon@v1.16.0...v1.16.1)


---

### [`v1.16.0`](remy/nodemon@1cda8fa...v1.16.0)
[Compare Source](remy/nodemon@1cda8fa...v1.16.0)


---

### [`v1.15.1`](https://github.com/remy/nodemon/releases/v1.15.1)
[Compare Source](remy/nodemon@v1.15.0...v1.15.1)
##### Bug Fixes

* ensure directories are watched, not files ([#&#8203;1260](`remy/nodemon#1260)) ([1cda8fa](remy/nodemon@1cda8fa)), closes [#&#8203;1259](`remy/nodemon#1259)

---

### [`v1.15.0`](https://github.com/remy/nodemon/releases/v1.15.0)
[Compare Source](remy/nodemon@v1.14.12...v1.15.0)
##### Features

* add support for `--spawn` ([#&#8203;1249](`remy/nodemon#1249)) ([5e88b04](remy/nodemon@5e88b04)), closes [#&#8203;1245](`remy/nodemon#1245)

---

### [`v1.14.12`](https://github.com/remy/nodemon/releases/v1.14.12)
[Compare Source](remy/nodemon@v1.14.11...v1.14.12)
##### Bug Fixes

* sniff for child.stdout before using it ([79e61f0](remy/nodemon@79e61f0))
* wrongly normalizing slashes in windows ([33fa6f4](remy/nodemon@33fa6f4)), closes [#&#8203;1236](`remy/nodemon#1236)

---

### [`v1.14.11`](https://github.com/remy/nodemon/releases/v1.14.11)
[Compare Source](remy/nodemon@v1.14.10...v1.14.11)
##### Bug Fixes

* don't ignore dot-directories ([4be493c](remy/nodemon@4be493c)), closes [#&#8203;1223](`remy/nodemon#1223)
* update deps - chokidar@&#8203;2.0.0 in particular ([9d49852](remy/nodemon@9d49852))

---

### [`v1.14.10`](https://github.com/remy/nodemon/releases/v1.14.10)
[Compare Source](remy/nodemon@v1.14.9...v1.14.10)
##### Bug Fixes

* node < 6.4.0 causing crash on 'rs' trigger ([e90f15a](remy/nodemon@e90f15a)), closes [#&#8203;1218](`remy/nodemon#1218)

---

### [`v1.14.9`](https://github.com/remy/nodemon/releases/v1.14.9)
[Compare Source](remy/nodemon@64a82ff...v1.14.9)
##### Bug Fixes

* correctly pass ignored rules to chokidar ([718a9ad](remy/nodemon@718a9ad)), closes [#&#8203;1202](`remy/nodemon#1202)
* ignorePermissionErrors in chokidar ([e95ea6f](remy/nodemon@e95ea6f))

---

### [`v1.14.8`](https://github.com/remy/nodemon/releases/v1.14.8)
[Compare Source](remy/nodemon@6e7ce4b...v1.14.8)
##### Bug Fixes

* clarify which config files are actually used ([2582d96](remy/nodemon@2582d96)), closes [#&#8203;1204](`remy/nodemon#1204)
* fail gracefully if postinstall fails ([64a82ff](remy/nodemon@64a82ff))

---

### [`v1.14.7`](https://github.com/remy/nodemon/releases/v1.14.7)
[Compare Source](remy/nodemon@v1.14.6...v1.14.7)
##### Bug Fixes

* swallow child.stdin err ([6e7ce4b](remy/nodemon@6e7ce4b)), closes [#&#8203;1195](`remy/nodemon#1195)

---

### [`v1.14.6`](https://github.com/remy/nodemon/releases/v1.14.6)
[Compare Source](remy/nodemon@v1.14.5...v1.14.6)
##### Bug Fixes

* watch both js and mjs files if main file is JavaScript ([d78bf3d](remy/nodemon@d78bf3d))

---

### [`v1.14.5`](https://github.com/remy/nodemon/releases/v1.14.5)
[Compare Source](remy/nodemon@v1.14.4...v1.14.5)
##### Bug Fixes

* don't use fork with `node inspect` ([0d9a892](remy/nodemon@0d9a892))

---

### [`v1.14.4`](https://github.com/remy/nodemon/releases/v1.14.4)
[Compare Source](remy/nodemon@v1.14.3...v1.14.4)
##### Bug Fixes

* expose no update flag ([c637717](remy/nodemon@c637717))
* handle exit(2) better ([5a914cb](remy/nodemon@5a914cb))
* incorrect count of watch files being reported ([7a04e2c](remy/nodemon@7a04e2c)), closes [#&#8203;1194](`remy/nodemon#1194)
* properly handle --no-update-notifier ([48048aa](remy/nodemon@48048aa))
* support implicit filename extension ([6e839d4](remy/nodemon@6e839d4)), closes [#&#8203;1193](`remy/nodemon#1193)

---

### [`v1.14.3`](https://github.com/remy/nodemon/releases/v1.14.3)
[Compare Source](remy/nodemon@v1.14.2...v1.14.3)
##### Bug Fixes

* ensure non-slurp is passed to script ([ad226af](remy/nodemon@ad226af)), closes [#&#8203;750](`remy/nodemon#750)

---

### [`v1.14.2`](https://github.com/remy/nodemon/releases/v1.14.2)
[Compare Source](remy/nodemon@v1.14.1...v1.14.2)
##### Bug Fixes

* stop saying there's another update required! ([dcd8911](remy/nodemon@dcd8911))

---

### [`v1.14.1`](https://github.com/remy/nodemon/releases/v1.14.1)
[Compare Source](remy/nodemon@v1.14.0...v1.14.1)
##### Bug Fixes

* defined diretory watching ([1e2516d](remy/nodemon@1e2516d))
* pass stdin to child process on -I ([1d88943](remy/nodemon@1d88943)), closes [#&#8203;1036](`remy/nodemon#1036)
* properly ignore defaults, don't match partial ([4589bc8](remy/nodemon@4589bc8)), closes [#&#8203;916](`remy/nodemon#916)

---

### [`v1.14.0`](https://github.com/remy/nodemon/releases/v1.14.0)
[Compare Source](remy/nodemon@v1.13.3...v1.14.0)
##### Bug Fixes

* remove scoped dep ([d15cf68](remy/nodemon@d15cf68)), closes [#&#8203;1180](`remy/nodemon#1180)
##### Features

* support wildcard extension matching ([009d868](remy/nodemon@009d868))

---

### [`v1.13.3`](https://github.com/remy/nodemon/releases/v1.13.3)
[Compare Source](remy/nodemon@v1.13.2...v1.13.3)
##### Bug Fixes

* nodemon reporting crash ([1171fc1](remy/nodemon@1171fc1)), closes [#&#8203;1173](`remy/nodemon#1173)

---

### [`v1.13.2`](https://github.com/remy/nodemon/releases/v1.13.2)
[Compare Source](remy/nodemon@v1.13.1...v1.13.2)
##### Bug Fixes

* switch to killing using numericals ([e9129c0](remy/nodemon@e9129c0)), closes [#&#8203;956](`remy/nodemon#956) [#&#8203;813](`remy/nodemon#813)

---

### [`v1.13.1`](https://github.com/remy/nodemon/releases/v1.13.1)
[Compare Source](remy/nodemon@v1.13.0...v1.13.1)
##### Bug Fixes

* fixed an issue where we tried to resolve null as path ([10ded94](remy/nodemon@10ded94))
* if no ps, walk /proc to kill child fully ([bf9b7a6](remy/nodemon@bf9b7a6))

---

### [`v1.13.0`](https://github.com/remy/nodemon/releases/v1.13.0)
[Compare Source](remy/nodemon@v1.12.7...v1.13.0)
##### Bug Fixes

* support nodemon index to expand to index.js ([a282afb](remy/nodemon@a282afb)), closes [#&#8203;1165](`remy/nodemon#1165)
##### Features

* support SIGHUP to restart nodemon ([30f999a](remy/nodemon@30f999a)), closes [#&#8203;393](`remy/nodemon#393)
* watch script regardless of extension ([f8a5abe](remy/nodemon@f8a5abe)), closes [#&#8203;461](`remy/nodemon#461)

---

### [`v1.12.7`](https://github.com/remy/nodemon/releases/v1.12.7)
[Compare Source](remy/nodemon@v1.12.6...v1.12.7)
##### Bug Fixes

* defensive check on accessing cmd.args ([fd961d6](remy/nodemon@fd961d6))
* support node arguments again ([d9e93ad](remy/nodemon@d9e93ad)), closes [#&#8203;1161](`remy/nodemon#1161)

---

### [`v1.12.6`](https://github.com/remy/nodemon/releases/v1.12.6)
[Compare Source](remy/nodemon@v1.12.5...v1.12.6)
##### Bug Fixes

* get tests to pass ([cf923a8](remy/nodemon@cf923a8))
* only use fork if node>4 ([f52615c](remy/nodemon@f52615c))
* restore node 4 min support ([6d760f4](remy/nodemon@6d760f4))
* travis CI build before-install ([3a6b8df](remy/nodemon@3a6b8df))

---

### [`v1.12.5`](https://github.com/remy/nodemon/releases/v1.12.5)
[Compare Source](remy/nodemon@v1.12.4...v1.12.5)
##### Bug Fixes

* pass through execArgs from config ([#&#8203;1142](`remy/nodemon#1142)) ([6a4fb22](remy/nodemon@6a4fb22))

---

### [`v1.12.4`](https://github.com/remy/nodemon/releases/v1.12.4)
[Compare Source](remy/nodemon@v1.12.3...v1.12.4)
##### Bug Fixes

* reduce help output (a teeny bit) ([2e1b496](remy/nodemon@2e1b496))

---

### [`v1.12.3`](https://github.com/remy/nodemon/releases/v1.12.3)
[Compare Source](remy/nodemon@24a4b84...v1.12.3)
##### Bug Fixes

* add commit lint ([2af6391](remy/nodemon@2af6391))
* Add support for multi-level filenames ([29a9a44](remy/nodemon@29a9a44))
* bump deps and fix tests for local dev ([#&#8203;1139](`remy/nodemon#1139)) ([6d57dac](remy/nodemon@6d57dac))
* catch module.parent.filename === undefined ([#&#8203;1053](`remy/nodemon#1053)) ([4c81e9a](remy/nodemon@4c81e9a))
* crash when passing argument to node (windows) ([469fa80](remy/nodemon@469fa80)), closes [#&#8203;1095](`remy/nodemon#1095)
* executable path handling under windows ([#&#8203;962](`remy/nodemon#962)) ([481dc8f](remy/nodemon@481dc8f))
* exit when fail to parse the config file ([#&#8203;921](`remy/nodemon#921)) ([63e8606](remy/nodemon@63e8606)), closes [#&#8203;651](`remy/nodemon#651)
* exit with code 1 on crash if --exitcrash ([#&#8203;946](`remy/nodemon#946)) ([facc8cb](remy/nodemon@facc8cb))
* help truncation on node 6.2 ([#&#8203;842](`remy/nodemon#842)) ([#&#8203;843](`remy/nodemon#843)) ([abc138f](remy/nodemon@abc138f))
* read config file before defaulting script parameter ([#&#8203;1110](`remy/nodemon#1110)) ([f3e0c29](remy/nodemon@f3e0c29))
* require node 6 or above in engines ([71eab1a](remy/nodemon@71eab1a))
* Support for .mjs es6 modules ([#&#8203;1138](`remy/nodemon#1138)) ([5a89df6](remy/nodemon@5a89df6))
* support signal on CLI ([#&#8203;1061](`remy/nodemon#1061)) ([3c352f2](remy/nodemon@3c352f2))
* sync help.txt to available options ([9b6c786](remy/nodemon@9b6c786))
* update readme ([3426224](remy/nodemon@3426224))
##### Features

* nodemonConfig support in package.json ([fb5da38](remy/nodemon@fb5da38)), closes [#&#8203;873](`remy/nodemon#873)

---

### [`v1.12.2`](remy/nodemon@469fa80...24a4b84)
[Compare Source](remy/nodemon@469fa80...24a4b84)


---

### [`v1.12.1`](remy/nodemon@6a4803d...469fa80)
[Compare Source](remy/nodemon@6a4803d...469fa80)


---

### [`v1.12.0`](remy/nodemon@8204b69...6a4803d)
[Compare Source](remy/nodemon@8204b69...6a4803d)


---

### [`v1.11.1`](remy/nodemon@v1.11.0...8204b69)
[Compare Source](remy/nodemon@v1.11.0...8204b69)


---

</details>




---

This PR has been generated by [Renovate Bot](https://renovatebot.com).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment