leptos-rs / leptos

Build fast web applications with Rust.
https://leptos.dev
MIT License
16.33k stars 651 forks source link

trunk serve --open success but no response. #2179

Closed butoften closed 10 months ago

butoften commented 10 months ago

I has download leptos example 「fetch 」 and run trunk serve --open the trace info show everything is success,but it didn't auto open the browser, and there's no url such as http://localhost:8000,

when i access http://localhost:8000 or 8080(i don't know ,just i guess),it can not work, that means trunk serve cmd is not completely completed,although it showed success

 trunk serve --open
2024-01-11T18:42:55.078308Z  INFO 🚀 Starting trunk 0.18.4
2024-01-11T18:42:55.238826Z  INFO 📦 starting build
2024-01-11T18:42:55.239858Z  INFO spawning asset pipelines
2024-01-11T18:42:55.869581Z  INFO building fetch
2024-01-11T18:42:55.869644Z  INFO copying & hashing icon path="public/favicon.ico"
2024-01-11T18:42:55.870964Z  INFO finished copying & hashing icon path="public/favicon.ico"
    Finished dev [unoptimized + debuginfo] target(s) in 0.27s
2024-01-11T18:42:56.226459Z  INFO fetching cargo artifacts
2024-01-11T18:42:56.562045Z  INFO using system installed binary app=wasm-bindgen detected_version=0.2.89
2024-01-11T18:42:56.563419Z  INFO calling wasm-bindgen for fetch
2024-01-11T18:42:56.997779Z  INFO rust build complete
2024-01-11T18:42:57.001642Z  INFO applying new distribution
2024-01-11T18:42:57.008532Z  INFO ✅ success

computer info: stystem: macOS Monterey 12.2.1 rustc: 1.77.0-nightly trunk: 0.18.4

i want to know if I has done the wrong step or miss some steps,thank you

gbj commented 10 months ago

It should be serving at http://localhost:8080

As with your other issue #2178 I'm not able to reproduce the issue: If I trunk trunk serve --open in that directory, it opens a browser window at 127.0.0.1:8080 showing the example.

What happens if you go to that address after running trunk serve? (And did the example actually compile? i.e., do you see the long cargo build output before the message you pasted above?)

butoften commented 10 months ago
  1. It showed 「Unable to access this website」when running trunk serve --open , and it does indeed display a long compilation output.
  2. In document, it said trunk will automatically compile my app, so it has compiled and show success, but the program doesn't proceed any further.
  3. Is there any other method to serve the project to replace trunk? I want to have a try
gbj commented 10 months ago

Sure. Trunk (https://trunkrs.dev/) is just a convenient build tool. If trunk build worked, it should have built all the files you'd need to serve into a dist folder. You should be able to serve those using any simple server.

butoften commented 10 months ago

I can run the project in dist folder with other server only trunk doesn't work, It's quite strange.

gbj commented 10 months ago

Strange. Haven't heard of issues before. It could be worth opening an issue on the trunk repo, but it sounds like it's not a Leptos issue (unless you've successfully used Trunk with other Rust/WASM projects).

butoften commented 10 months ago

ok, thank you, i will close this issue thank you