# How to exclude files from being watched by elm-live

**URL:** <https://discourse.elm-lang.org/t/how-to-exclude-files-from-being-watched-by-elm-live/10477>\
**Category:** Learn\
**Created:** [November 4, 2025, 6:34am UTC](https://discourse.elm-lang.org/t/how-to-exclude-files-from-being-watched-by-elm-live/10477 "2025-11-04T06:34:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![halloleo](https://avatars.discourse-cdn.com/v4/letter/h/ccd318/32.png) [@halloleo](https://discourse.elm-lang.org/u/halloleo)\
**Post date:** [November 4, 2025, 6:34am UTC](https://discourse.elm-lang.org/t/how-to-exclude-files-from-being-watched-by-elm-live/10477/1 "2025-11-04T06:34:30Z")

</div>

I use elm-live to serve my Elm, app in development.

I run it like this:

`elm-live src/Main.elm -d site -- --output=site/index.html`

This works fine - until I create (via my editor Emacs) arbitrary backup file to some of the (code-wise uninteresting) Markdown files like a TODO.md I have in the project root. Here is what happens:

1. I edit the TODO.md, Emacs creates a backup file .#TODO.md
2. elm-live seems to watch the project root (Why? The source files are in src!) and finds the in-progress file .#TODO.md
3. elm-live chokes on that file with:

`[Error: ENOENT: no such file or directory, stat '/my/project/dir/.#TODO.md'] {`  
` errno: -2,`  
` code: 'ENOENT',`  
` syscall: 'stat',`  
` path: '/my/project/dir/.#TODO.md'`  
`}`

So my question is: How can I avoid this? How can i exclude the root from being watched?

Thanks for any pointers!

---

<div class="post-metadata">

**Author:** ![lydell](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/lydell/32/178_2.png) [@lydell](https://discourse.elm-lang.org/u/lydell)\
**Post date:** [November 4, 2025, 8:50am UTC](https://discourse.elm-lang.org/t/how-to-exclude-files-from-being-watched-by-elm-live/10477/2 "2025-11-04T08:50:08Z")

</div>

elm-live is not maintained. You probably need to fork it and fix the bug yourself.

You can also try [elm-watch](https://lydell.github.io/elm-watch/). Its beta version (which is in fact quite stable) has a built-in HTTP server, and it might do everything you need.

---

<div class="post-metadata">

**Author:** ![ni-ko-o-kin](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/ni-ko-o-kin/32/2693_2.png) [@ni-ko-o-kin](https://discourse.elm-lang.org/u/ni-ko-o-kin)\
**Post date:** [November 4, 2025, 8:56am UTC](https://discourse.elm-lang.org/t/how-to-exclude-files-from-being-watched-by-elm-live/10477/3 "2025-11-04T08:56:24Z")

</div>

I had similar problems with other tools too. Add this to your emacs configuration:

(setq-default create-lockfiles nil)

---

<div class="post-metadata">

**Author:** ![halloleo](https://avatars.discourse-cdn.com/v4/letter/h/ccd318/32.png) [@halloleo](https://discourse.elm-lang.org/u/halloleo)\
**Post date:** [November 4, 2025, 11:48pm UTC](https://discourse.elm-lang.org/t/how-to-exclude-files-from-being-watched-by-elm-live/10477/4 "2025-11-04T23:48:46Z")

</div>

> [@lydell](#):
>
> elm-live is not maintained. You probably need to fork it and fix the bug yourself.

Good to know. Thanks.

---

<div class="post-metadata">

**Author:** ![halloleo](https://avatars.discourse-cdn.com/v4/letter/h/ccd318/32.png) [@halloleo](https://discourse.elm-lang.org/u/halloleo)\
**Post date:** [November 4, 2025, 11:51pm UTC](https://discourse.elm-lang.org/t/how-to-exclude-files-from-being-watched-by-elm-live/10477/5 "2025-11-04T23:51:44Z")

</div>

> [@ni-ko-o-kin](#):
>
> Add this to your emacs configuration:
> 
> ```
> (setq-default create-lockfiles nil)
> 
> ```

This works. 😄 Thanks heaps.

I might look into setting

```
lock-file-name-transforms

```

instead, so that lock files are still created, but in another directory.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/elm_lang/original/1X/50a05e53677a2c3b47776d7abd0f113eb50193a1.png) [@system](https://discourse.elm-lang.org/u/system)\
**Post date:** [November 14, 2025, 11:51pm UTC](https://discourse.elm-lang.org/t/how-to-exclude-files-from-being-watched-by-elm-live/10477/6 "2025-11-14T23:51:58Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
