remy / nodemon

Monitor for any changes in your node.js application and automatically restart the server - perfect for development
http://nodemon.io/
MIT License
26.21k stars 1.72k forks source link

How to watch for package changes when node_modules is huge? #2113

Closed skalinkin closed 1 year ago

skalinkin commented 1 year ago

When I set "ignoreRoot": [".git"] in nodemon.js

I am getting the following error

[nodemon] Internal watch failed: ENOSPC: System limit for number of file watchers reached, watch '/usr/local/upgrade-manager/node_modules/@babel/types/lib/definitions'

I do not really need to watch whole node_modules. I need to watch my company scope packages.

How to configure nodemon to watch particular scope dir in node_modules?

github-actions[bot] commented 1 year ago

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

ValentinGurkov commented 1 year ago

I'm facing something similar, I only want to watch for changes in my workspace dependencies in node_modules. Unfortunately, I can't offer good solutions. You can modify the watch array to include only workspace packages using their real location in the repo, not in the node_modules folder.

Or modify ignoreRoort to exclude the node_modules except a few folders (I haven't tested this yet) like node_modules/!(workspace-package)/**/*

What is even worse is that these solutions are not at all flexible. If we could configure nodemon with a .js file, it might be possible to have this done in a bit more extensible way (like reading your workspace dependencies from package.json).

github-actions[bot] commented 1 year ago

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

remy commented 1 year ago

@ValentinGurkov you can require in nodemon as a module and control what it's watching.

The bottom line is that watching a huge number of files isn't viable with nodemon and something that's so much of an edge case that I can't support.

Though as I said, you can certainly require in nodemon, or possibly attempt it with node's native file watch and reload - not sure it would be any better though…