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

Live Reloading Broken in Windows 10 #62

Closed
superherointj opened this issue Aug 23, 2017 · 19 comments
Closed

Live Reloading Broken in Windows 10 #62

superherointj opened this issue Aug 23, 2017 · 19 comments

Comments

@superherointj
Copy link

Since latest changes live reloading is not working in Windows 10.
Phoenix 1.2 worked.
Phoenix 1.3 doesn't.
Tested by two different users.
I was asked to post here instead of Phoenix tracker.
I don't know how to dig further the issue.

Erlang/OTP 20 [erts-9.0] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10]
Elixir 1.5.1

@chrismccord
Copy link
Member

Please include your version of phoenix_live_reload from mix deps

@josevalim
Copy link
Member

Also, is anything logged when you run mix phx.server?

@superherointj
Copy link
Author

superherointj commented Aug 23, 2017

On changing files it is not logging anything to 'iex' on phoenix 1.3 but on phoenix 1.2 it shows log.
For phoenix 1.3, phoenix_live_reload version installed is 1.1.0.
For phoenix 1.2.4. phoenix_live_reload version installed is 1.0.8.
It was tested creating a new phoenix project from scratch using 'mix phx.new xxx'.
Any further step?

@josevalim
Copy link
Member

@superherointj just to be double sure, can you please start a new phoenix session with iex -S mix phx.server, do a new request and then post here everything that is printed to the terminal from the call to IEx up to the end? Thanks!

@OvermindDL1
Copy link

As a data point, a Phoenix 1.3 project on Windows 10 in MIX_ENV=dev reloads files fine here, css, source, and templates.

@superherointj
Copy link
Author

superherointj commented Aug 23, 2017

D:\dev\elixir\liver>iex -S mix phx.server
[info] Running LiverWeb.Endpoint with Cowboy using http://0.0.0.0:4000
Interactive Elixir (1.5.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> 14:48:30 - info: compiled 5 files into 2 files, copied 3 in 1.1 sec

HERE I OPEN THE PAGE

iex(1)> [info] GET /
iex(1)> [debug] Processing with LiverWeb.PageController.index/2
Parameters: %{}
Pipelines: [:browser]
iex(1)> [info] Sent 200 in 94ms

HERE I CHANGE ONE FILE FOR EXAMPLE APP.JS added a console.log('changed') to it

iex(1)> 14:49:39 - info: compiled app.js and 3 cached files into app.js in 115 ms
iex(1)>

There is no additional logs!!

See picture:

@josevalim
Copy link
Member

Thanks @OvermindDL1! Can you please check it after mix deps.update phoenix_live_reload as well? We have recently released a new version, so you may not be running on the latest.

@josevalim
Copy link
Member

@superherointj thanks! We can see that the assets are being recompiled. So it is indeed something specific to the live reload in particular.

@superherointj
Copy link
Author

D:\dev\elixir\liver>mix deps.update phoenix_live_reload
Running dependency resolution...
Dependency resolution completed:
cowboy 1.1.2
cowlib 1.0.2
file_system 0.1.5
gettext 0.13.1
mime 1.1.0
phoenix 1.3.0
phoenix_html 2.10.4
phoenix_live_reload 1.1.0
phoenix_pubsub 1.0.2
plug 1.4.3
poison 3.1.0
ranch 1.3.2

@josevalim
Copy link
Member

Sorry, the mix deps.update command was for @OvermindDL1. :) You are on latest.

@superherointj, can you please try this:

$ iex -S mix phx.server
iex> FileSystem.start_link(dirs: [Path.absname("")], name: :trying_out)

And let us know what it returns?

@superherointj
Copy link
Author

superherointj commented Aug 23, 2017

What should I fill Path.absname("") with? Try it empty?

--
D:\dev\elixir\liver>iex -S mix phx.server
[info] Running LiverWeb.Endpoint with Cowboy using http://0.0.0.0:4000
Interactive Elixir (1.5.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> 15:07:12 - info: compiled 5 files into 2 files, copied 3 in 1.2 sec
iex(1)> FileSystem.start_link(dirs: [Path.absname("")], name: :trying_out)
{:ok, #PID<0.326.0>}

HERE I LOAD PAGE

iex(2)> [info] GET /
iex(2)> [debug] Processing with LiverWeb.PageController.index/2
Parameters: %{}
Pipelines: [:browser]
iex(2)> [info] Sent 200 in 32ms

HERE I MAKE CHANGE TO app.js

iex(2)> 15:08:48 - info: compiled app.js and 3 cached files into app.js in 93 ms


No logs about change event on iex. No automatic update on browser.
I could give you access to this computer on TeamViewer. If it can speed things up for you.

@josevalim
Copy link
Member

@superherointj helped me find the bug. The issue is that the paths reported by file_system on Windows are using \\ but the patterns only use /.

@falood @mveytsman what do you think should be the proper solution here?

Should the filesystem project normalize paths? Or should it return the raw paths and Phoenix does the normalization? In any case, the solution is easy:

path = path |> Path.split |> Path.join

It is just a matter of deciding the best place to put it.

@falood
Copy link
Contributor

falood commented Aug 23, 2017

image

It seems erlang use / as default path separate in windows, so I think I should return the same format with my code, right?
BTW, Path.join also use / for windows.

@josevalim
Copy link
Member

@falood yes, that's why using path |> Path.split |> Path.join works, because Elixir and Erlang normalizes it. If we want to fix it in file_ssytem, it should be a question of doing the split+join here: https://github.com/falood/file_system/blob/master/lib/file_system/backends/fs_windows.ex#L152

But if you don't think we should change file_system, then I can fix it here. :) your call!

@falood
Copy link
Contributor

falood commented Aug 23, 2017

sure, I'll fix it and bump a new version today, thank you!

@falood
Copy link
Contributor

falood commented Aug 24, 2017

@josevalim I have fixed and released the new version, it's not a fast-forward change, so the new version number is v0.2.0.

@josevalim
Copy link
Member

Beautiful, thank you! @superherointj can you please run:

 mix deps.clean phoenix_live_reload
 mix deps.clean file_system
 mix deps.update file_system

and let us know if it works? Thank you.

@superherointj
Copy link
Author

superherointj commented Aug 24, 2017

file_system 0.2.0; phoenix_live_reload 1.1.0
Works just fine.
phoenix_live_reload version wasn't bumped.
Another day saved! A beautiful day indeed. :)

@josevalim
Copy link
Member

❤️ 💚 💙 💛 💜

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

No branches or pull requests

5 participants