lydell / elm-watch

`elm make` in watch mode. Fast and reliable.
https://lydell.github.io/elm-watch/
MIT License
155 stars 8 forks source link

source-directories with big ancestor directory → file watcher error #62

Closed lue-bird closed 1 month ago

lue-bird commented 1 year ago

With a source-directories field containing both src and a distant unpublished library

"source-directories": [
    "src",
    "../../../some-libraries/elm-midi/src"
]

elm-watch throws the following error and terminates its process

 21:14:20 Compilation finished in 2.26 s.
-- WATCHER ERROR ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

The file watcher encountered an error, which means that it cannot continue.
elm-watch is powered by its file watcher, so I have to exit at this point.

See if this is something you can solve by maybe removing some problematic files
or something!

This is the error message I got:

ENOSPC: System limit for number of file watchers reached, watch '/home/lue/Desktop/some-libraries/some-unrelated-library/.git/objects/87/05073607de7d25a6bcadb660cf7e1b8bfdd447'

My uneducated guess is that this function: https://github.com/lydell/elm-watch/blob/9d98d0e0224ee24eb6d55404898cbe45f5ba1e51/src/Project.ts#L460

watches all the library files and many more within the parent directory of some-libraries and this app's instead of only the relevant ones from only the specified directories.

Current workaround is moving the unpublished library code to the app's directory.

Anyway, much, much love for building elm-watch! 🌈⃤🦋

lydell commented 1 year ago

What an excellent bug report! Thank you! 💙

lydell commented 1 year ago

ℹ️ This should be fixed in the beta version (npm install elm-watch@beta), but I haven’t tested it.