dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

I/O error dx hot reload

Open alearcy opened this issue 1 year ago • 13 comments

Problem

Running both Tailwind watch and Dioxus hot-reload, during reload I get: [ERROR] I/O Error: Unable to access the file. The file is being used by another process. (os error 32) Maybe it try to watch the public folder that is already used by the tailwind watcher.

Steps To Reproduce

Steps to reproduce the behaviour:

Open a terminal and run npx tailwindcss -i ./input.css -o ./public/tailwind.css --watch to generate public/tailwind.css each time the input.css was modified. Open another terminal and run dx serve --platform desktop --hot-reload. Try to write/change an rsx! or a CSS.

Expected behavior

Hot reload must run and I can see the new content/style.

Environment:

  • Dioxus version: [0.4]
  • Rust version: [1.70.0]
  • OS info: [Windows 11]
  • App platform: [desktop]

Questionnaire

  • [ ] I'm interested in fixing this myself but don't know where to start
  • [ ] I would like to fix and I have a solution
  • [ ] I don't have time to fix this right now, but maybe later

alearcy avatar Aug 03 '23 20:08 alearcy

I tried to remove Tailwind from dioxus.toml, from public folder and from the custom head, but the error still remains..so I guess Tailwind was not the problem..

alearcy avatar Aug 04 '23 13:08 alearcy

If you check your task manager, are there any other instances of the dioxus cli running? I wonder if there is a conflict when two instances try to write to the hot reloading socket

ealmloff avatar Aug 04 '23 18:08 ealmloff

It is strange...I also restart my computer and nothing changes...but I noticed that if I run only dx serve it hot reload right (without args hot-reload and platform)...

alearcy avatar Aug 04 '23 22:08 alearcy

dx serve will rebuild your application when it notices any changes. dx serve --hot-reload will patch the rsx without recompiling when it notices any changes

ealmloff avatar Aug 04 '23 22:08 ealmloff

Ok, thanks for the explanation. In the activity monitor I didn't find any cargo process tho.

alearcy avatar Aug 04 '23 22:08 alearcy

I search for dioxus, dx, cargo...nothing is listed in activity monitor. I tried to use another code editor, another terminal....but I always get that error..with and without tailwind...I tried to create a new project from scratch with dx create but the error still...

alearcy avatar Aug 05 '23 21:08 alearcy

I'm encountering the exact same problem.

  • Dioxus version: [0.4]
  • Rust version: [1.72.1]
  • OS info: [Windows 10]
  • App platform: [desktop]

JoshLambda avatar Sep 29 '23 13:09 JoshLambda

That's probably because I'm using the desktop renderer from crates.io. Documentation says hot reloading works on desktop renderer with git version only.

JoshLambda avatar Oct 01 '23 11:10 JoshLambda

Same issue here, @JoshLambda that documentation is old, it should now work with dx serve --platform desktop --hot-reload

Hamcha avatar Nov 18 '23 12:11 Hamcha

The documentation for 0.4 is here

ealmloff avatar Nov 18 '23 14:11 ealmloff

Some additional information would be very helpful debugging this issue:

  • What does your code look like (preferably a minimal example)
  • What does your workspace file system look like? Is there multiple packages, do you have local dependancies, etc
  • What exact code do you change that fails to hot reload? Does hot reloading work once after you create the project or does it fail on a new project

ealmloff avatar Nov 18 '23 14:11 ealmloff

I literally followed this page: https://dioxuslabs.com/learn/0.4/getting_started/liveview

Code is exactly the example (plus imports), then run dx serve --hot-reload --platform desktop as specified and modified the "Hello, world!" in "Helloo, world!", but any change causes the error. The hotreload fails every time (I can still manually reload the web page to see changes)

No workspace or other packages other than the one specified in the example (axum, dioxus, dioxus-liveview, tokio)

I'm also on Windows (10, not 11) if that can help

Hamcha avatar Nov 18 '23 17:11 Hamcha

I can reproduce the liveview issue on macos. I see a flash of compiling... which should happen when dioxus-cli sees something that is not static rsx that is changed. I don't see the same error on macos for desktop

ealmloff avatar Nov 20 '23 14:11 ealmloff