Skip to content

Allow running two apps on 127.0.0.1 and another address on same port #12417

@Exagone313

Description

@Exagone313

Describe the bug

Currently, when starting two React apps with e.g. HOST=127.0.0.1 PORT=3000 and HOST=127.2.2.2 PORT=3000, the second app will fail with an error Something is already running on port 3000, although starting two apps on same port but different addresses is valid. Note that this works when not using address 127.0.0.1.

Did you try recovering your dependencies?

N/A

Environment

N/A

Steps to reproduce

  1. Create a React app
  2. Run HOST=127.0.0.1 PORT=3000 npm run start in a first terminal
  3. Run HOST=127.2.2.2 PORT=3000 npm run start in a second terminal

Expected behavior

Both apps are running on their respective address.

Actual behavior

Only the first app (on 127.0.0.1:3000) is running, the second app didn't start with an error: Something is already running on port 3000.

When patching the code manually to bypass this check, both apps can run aside without issues.

Reproducible demo

Any React app is applicable.

Trivia

The issue is coming from the package detect-port-alt from @Timer, a fork of detect-port which adds host support, but doesn't cover this edge case. Unfortunately, this fork doesn't allow creating GitHub issues and changes have not been upstreamed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions