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

[bug] Tauri 2 can't change port number #10819

Closed
cryptoquick opened this issue Aug 28, 2024 · 2 comments
Closed

[bug] Tauri 2 can't change port number #10819

cryptoquick opened this issue Aug 28, 2024 · 2 comments
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug

Comments

@cryptoquick
Copy link

Describe the bug

Despite specifying both the env var and the port flag, it still tries to open the dev server on port 8080.

TAURI_CLI_PORT=1776 cargo tauri dev --port 1776                                                                                                       3679ms  Wed Aug 28 17:24:21 2024
    Running BeforeDevCommand (`trunk serve`)
2024-08-28T23:24:30.781117Z  INFO 🚀 Starting trunk 0.20.3
2024-08-28T23:24:30.873699Z  INFO 📦 starting build
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.10s
2024-08-28T23:24:31.471878Z  INFO tool version mismatch (required: 0.2.93, system: 0.2.79)
Browserslist: caniuse-lite is outdated. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: https://github.com/browserslist/update-db#readme

Rebuilding...

Done in 260ms.
2024-08-28T23:24:32.301974Z  INFO applying new distribution
2024-08-28T23:24:32.303744Z  INFO ✅ success
2024-08-28T23:24:32.303787Z  INFO 📡 serving static assets at -> /
2024-08-28T23:24:32.304138Z  INFO 📡 server listening at:
2024-08-28T23:24:32.304142Z  INFO     🏠 http://127.0.0.1:8080/
2024-08-28T23:24:32.304144Z  INFO     🏠 http://[::1]:8080/
2024-08-28T23:24:32.304190Z ERROR error from server task error=Address already in use (os error 98)
2024-08-28T23:24:32.304222Z ERROR Address already in use (os error 98)
    Error The "beforeDevCommand" terminated with a non-zero status code.

Reproduction

Should be reproducible with create-tauri-app --rc

Expected behavior

The dev server should accept the provided port number and run on that port.

Full tauri info output

[✔] Environment
    - OS: Garuda Linux Soaring X64
    ✔ webkit2gtk-4.1: 2.44.3
    ✔ rsvg2: 2.58.3
    ✔ rustc: 1.80.1 (3f5fd8dd4 2024-08-06)
    ✔ cargo: 1.80.1 (376290515 2024-07-16)
    ✔ rustup: 1.27.1 (2024-05-07)
    ✔ Rust toolchain: stable-x86_64-unknown-linux-gnu (environment override by RUSTUP_TOOLCHAIN)
    - node: 22.7.0
    - yarn: 1.22.22
    - npm: 10.8.2

[-] Packages
    - tauri [RUST]: 2.0.0-rc.5
    - tauri-build [RUST]: 2.0.0-rc.5
    - wry [RUST]: 0.42.0
    - tao [RUST]: 0.29.1
    - tauri-cli [RUST]: 2.0.0-rc.6

[-] App
    - build-type: bundle
    - CSP: unset
    - frontendDist: ../dist
    - devUrl: http://localhost:1777/

Stack trace

N/A

Additional context

N/A

@cryptoquick cryptoquick added status: needs triage This issue needs to triage, applied to new issues type: bug labels Aug 28, 2024
@amrbashir
Copy link
Member

--port only affects the built-in devServer (which only works if you don't specify devUrl).

Anyways, you're using trunk to serve your frontend in development, so you'll need to change beforeDevCommand in tauri.conf.json to trunk serve --port=1776, you'll also need to change devUrl to match this new port

@amrbashir amrbashir closed this as not planned Won't fix, can't repro, duplicate, stale Aug 28, 2024
@cryptoquick
Copy link
Author

That works! Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs triage This issue needs to triage, applied to new issues type: bug
Projects
None yet
Development

No branches or pull requests

2 participants