Skip to content

Check 0.0.0.0 as well as localhost/127.0.0.1 when checking for used port #10638

@thomasballinger

Description

@thomasballinger

Description

When a developer already has a dev server running (say with Next.js) that uses 0.0.0.0:3000, Vite doesn't notice and starts a dev server at localhost:3000.

It's a special case, but a common one. It'd be great it Vite could notice this.

Possible dup of #5241, but it wasn't clear to me in that issue that the solution below was explicitly discarded.

Suggested solution

Could Vite could check 0.0.0.0 as well? edit: happy to make a PR, wanted to hear whether this is felt to be a good idea first

Alternative

In #5241 the solution is proposed #5241 (comment)

This problem is solved,set server.host = 0.0.0.0,example config:

server: {
  host: '0.0.0.0',
},

which does sound like the real fix! But for this common case it might be worth checking 0.0.0.0.

Additional context

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions