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

Does not exclude node_modules when watching parent to cwd #1246

Closed
dkebler opened this issue Feb 5, 2018 · 9 comments
Closed

Does not exclude node_modules when watching parent to cwd #1246

dkebler opened this issue Feb 5, 2018 · 9 comments
Labels
bug confirmed bug has PR

Comments

@dkebler
Copy link

dkebler commented Feb 5, 2018

  • nodemon -v: 1.14.2
  • node -v: 9.4
  • Operating system/terminal environment: linux/xenial
  • Command you ran:
    "node_modules/.bin/nodemon --require @std/esm --watch ../ examples/bus",

Expected behaviour

runs without issue

Actual behaviour

the watcher is watching node_modules folders and throws errors

Steps to reproduce

set up a two repos. Fire up nodemon in one repo (cwd) but watch the parent folder for both repos (--watch ../).

Note: The repo running the code with nodemon has dependencies I am changing in the other allied repo(s) thus my desire to watch them. I import those module dependencies directly during during development before publishing and using npm for import since they too are under development and was wanting nodemon to watch them.


output when running the command above. uci/uci-logger is another repo/directory. The CWD was uci/uci-bus.

[nodemon] 1.14.12
[nodemon] to restart at any time, enter rs
[nodemon] watching: /opt/uci/**/*
[nodemon] starting node --require @std/esm examples/bus src/bus
{ id: 'i2c-bus', us: { path: '/opt/uci/unix.sock' } }
[nodemon] Internal watch failed: watch /opt/uci/uci-base/node_modules/urlgrey/package.json ENOSPC
[nodemon] Internal watch failed: watch /opt/uci/uci-logger/node_modules/make-dir/node_modules/pify/readme.md ENOSPC

If applicable, please append the --dump flag on your command and include the output here ensuring to remove any sensitive/personal details or tokens.

--------------
node: v9.4.0
nodemon: 1.14.12
command: /usr/local/bin/node /opt/uci/uci-i2c-bus/node_modules/.bin/nodemon --require @std/esm --dump --watch ../ examples/bus
cwd: /opt/uci/uci-i2c-bus
OS: linux arm
--------------
{ run: false,
  system: { cwd: '/opt/uci/uci-i2c-bus' },
  required: false,
  dirs: [ '/opt/uci' ],
  timeout: 1000,
  options: 
   { dump: true,
     watch: [ '../', re: /\.\.\// ],
     ignore: 
      [ '**/.git/**',
        '**/.nyc_output/**',
        '**/.sass-cache/**',
        '**/bower_components/**',
        '**/coverage/**',
        '**/node_modules/**',
        re: /.*.*\/\.git\/.*.*|.*.*\/\.nyc_output\/.*.*|.*.*\/\.sass\-cache\/.*.*|.*.*\/bower_components\/.*.*|.*.*\/coverage\/.*.*|.*.*\/node_modules\/.*.*/ ],
     ignoreRoot: 
      [ '**/.git/**',
        '**/.nyc_output/**',
        '**/.sass-cache/**',
        '**/bower_components/**',
        '**/coverage/**',
        '**/node_modules/**' ],
     restartable: 'rs',
     colours: true,
     execMap: { py: 'python', rb: 'ruby' },
     stdin: true,
     runOnChangeOnly: false,
     verbose: false,
     signal: 'SIGUSR2',
     stdout: true,
     watchOptions: {},
     execOptions: 
      { script: 'src/bus',
        exec: 'node',
        args: [ '--require', '@std/esm', 'examples/bus' ],
        scriptPosition: 3,
        nodeArgs: undefined,
        execArgs: [],
        ext: 'js,mjs,json',
        env: {} },
     monitor: 
      [ '/opt/uci/**/*',
        '!**/.git/**',
        '!**/.nyc_output/**',
        '!**/.sass-cache/**',
        '!**/bower_components/**',
        '!**/coverage/**',
        '!**/node_modules/**' ] },
  load: [Function],
  reset: [Function: reset],
  lastStarted: 0,
  loaded: [],
  watchInterval: null,
  signal: 'SIGUSR2',
  command: 
   { raw: 
      { executable: 'node',
        args: [ '--require', '@std/esm', 'examples/bus', 'src/bus' ] },
     string: 'node --require @std/esm examples/bus src/bus' } }

@remy
Copy link
Owner

remy commented Feb 5, 2018

Can you try this first. You're getting the ENOSPC error, so I did a quick google, and I wonder if that would solve the issue.

@remy
Copy link
Owner

remy commented Feb 5, 2018

Another question (sorry, I found your issue a bit confusing to follow), when nodemon is failing on this:

[nodemon] Internal watch failed: watch /opt/uci/uci-base/node_modules/urlgrey/package.json ENOSPC
[nodemon] Internal watch failed: watch /opt/uci/uci-logger/node_modules/make-dir/node_modules/pify/readme.md ENOSPC

Did you expect nodemon to watch these, or not?

@remy remy added the needs more info not enough information in issue to debug label Feb 5, 2018
@dkebler
Copy link
Author

dkebler commented Feb 6, 2018

no should not watch any files in a node_modules folder (that is supposed to be the default) and it does work normally when watched files are under the cwd. But here I am asking to watch in a parent to cwd and that's where the issue arises. FYI, After throwning those nodemon exists

@dkebler
Copy link
Author

dkebler commented Feb 6, 2018

I can up the number of inoftify watches but it's only reaching that huge number because it's watching node_modules/ folder files. The actual repos in the parent only come to maybe 50 all totalo if their respective node_modules folders are excluded, but that is not the case they are being included.

@dkebler
Copy link
Author

dkebler commented Feb 6, 2018

assuming this deosn't happen for you using --watch ../ could it then be using @std/esm

@remy
Copy link
Owner

remy commented Feb 6, 2018

Okay, I follow what's happening. node_modules are ignored relative from the root, so it's including those that are not hanging off the cwd.

I'll mark as a bug and take a shot at a fix when I have time, unless you raise a PR first.

@remy remy added bug confirmed bug and removed needs more info not enough information in issue to debug labels Feb 6, 2018
@dkebler
Copy link
Author

dkebler commented Feb 7, 2018

I'd like to tackle a PR but probably not going to happen. Not a big deal at this moment but something nice to have when I am developing multiple dependent modules concurrently. Can wait. Thx

@dkebler
Copy link
Author

dkebler commented Feb 7, 2018

BTW because of your log message in nodemon install I started participating in the open collective. When they get paypal going even with some $, good idea that. So no PR :-( but appreciate your efforts and try to repay with putting out useful repos made on the shoulders of projects like nodemon.

remy added a commit that referenced this issue Feb 13, 2018
@remy remy added the has PR label Feb 13, 2018
remy added a commit that referenced this issue Feb 15, 2018
* docs: add sponsors

[skip ci]

* fix: make watch & ignore relative

Fixes #1246

* fix: relative parent watching and ignore

* chore: lint

* test: fix bail on options
@oliverbot
Copy link

oliverbot bot commented Feb 15, 2018

Thanks for raising this issue, and hopefully you're happy with @remy's fix. If you'd like to support this project, you can do just that through the open collective https://opencollective.com/nodemon/donate or at the very least, starring this project would give me @remy a little smile ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug confirmed bug has PR
Projects
None yet
Development

No branches or pull requests

2 participants