Skip to content

Starting multiple apps in dev mode uses same server (127.0.0.1:1430). #6186

@prabhugopal

Description

@prabhugopal

Describe the bug

Hi, I am just starting with Tauri.. I am having an issue with multiple apps, when i am running multiple apps in dev mode, all the apps are sharing the same ui, instead of its own ui.. What i noticed was all the apps frontend communicates to the same server, which is nothing but the first server started while running the first app.. Also the other apps, which are started after first app failing to start app server with following error..
error binding to 127.0.0.1:1430..
looks like tauri always uses a static server config..

Is there anyway we can set the server host & port while running cargo tauri dev
Something like below should help
cargo tauri dev --host <host-ip/name> --port <port-no>

Reproduction

  1. Create 2 or more tauri apps using cargo create-tauri-app
  2. Go ahead & update one of the apps' index.html so that it is now same from the other ones.
  3. Now start the apps one by one, in dev mode cargo tauri dev.

We will always see the same ui rendered for all the apps, also check console for the below error for all the apps started after first app.

error binding to 127.0.0.1:1430..

Since the port is already bind to first app server, starting from 2nd app the servers failed to start and clients start rendering the ui content from first app.

Expected behavior

Expect to see the ui specific to the app, also either server should start with different port instead of static one or we should have option of starting the server with different port as below.

cargo tauri dev --host <host-ip/name> --port <port-no>

Platform and versions

Environment
› OS: Mac OS 13.1.0 X64
› Node.js: 16.18.0
› npm: 8.19.2
› pnpm: Not installed!
› yarn: Not installed!
› rustup: 1.25.2
› rustc: 1.67.0
› cargo: 1.67.0
› Rust toolchain: stable-aarch64-apple-darwin

Packages
WARNING: no lock files found, defaulting to npm
› @tauri-apps/cli [NPM]: 1.2.3
› @tauri-apps/api [NPM]: Not installed!
› tauri [RUST]: 1.2.4,
› tauri-build [RUST]: 1.2.1,
› tao [RUST]: 0.15.8,
› wry [RUST]: 0.23.4,

App
› build-type: bundle
› CSP: unset
› distDir: ../src
› devPath: ../src
package.json not found

App directory structure
├─ src-tauri
├─ .vscode
└─ src

Stack trace

thread '<unnamed>' panicked at 'error binding to 127.0.0.1:1430: error creating server listener: Address already in use (os error 48)', /Users/prabhugopal/.cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.14.23/src/server/server.rs:79:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
        Info Watching /Users/prabhugopal/Learning/tauri/hello-next/src-tauri for changes...
   Compiling hello-next v0.0.0 (/Users/prabhugopal/Learning/tauri/hello-next/src-tauri)
    Finished dev [unoptimized + debuginfo] target(s) in 1.24s

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions