Phoenix hot code reloading thrown off by spaces in directory

I’m relatively new to Phoenix, and running into an issue with hot code reloading. When starting up the server, I get an error:

Couldn't watch /mnt/c/Users/Zach: No such file or directory

The directory is correctly written as /mnt/c/Users/Zach OBrien, so I’m sure the space is throwing the configuration off somehow. I tried going into dev.exs and changing the cd value as such:

watchers: [
    node: [
      cd: "/mnt/c/Users/Zach\ OBrien/Documents/Personal\ Projects/personal_site/assets"

by escaping the spaces with slashes. But I end up with the same error. Any help with this issue is greatly appreciated.

A single \ doesn’t make it past the Elixir parser:

iex(1)> s = "a\ b"
"a b"

Two in a row will:

iex(3)> IO.puts("a\\ b")
a\ b

but I don’t know if that will help.

1 Like

Unfortunately that didn’t work, but thanks for the idea! I think for now I’m just going to move my project folder into C. Not the most elegant solution but it works.

This very much seems like a bug in Phoenix (or possibly one of its dependencies). I’m sure the Phoenix team would be grateful if you open a bug on the Phoenix development repository :smiley:

1 Like

Could you share what your code looked like after this modification? Thanks

Do you need the fully qualified path? Would cd: "./assets" be enough?

1 Like

You could also try with a mount point without space in the name, and see if it works, if not, then the problem is somewhere else.

It might be that inotify does not work on the mounted directory.

By the way, are You using some sort of virtual machine? or docker?

1 Like

I’d suggest not having spaces in folders for programming projects. E.g. anything depending on elixir_make won’t compile properly (with no obvious way to make it work for folders with spaces from what I’ve been told).

1 Like

Just tried this, unfortunately didn’t work.

1 Like