Skip to content

Server restarts on different port #16278

@woutrbe

Description

@woutrbe

Astro Info

Astro                    v6.1.5
Vite                     v7.3.2
Node                     v22.18.0
System                   macOS (arm64)
Package Manager          npm
Output                   server
Adapter                  @astrojs/node (v10.0.4)
Integrations             @astrojs/react (v5.0.3)

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

I've been encountering this a couple of times now.

I start a dev server on a custom port:

➜  web npm run dev -- --port 45345

> [email protected] dev
> astro dev --port 45345

 astro  v6.1.5 ready in 787 ms
┃ Local    http://localhost:45345/
┃ Network  use --host to expose

I then added/removed/changed some environment variables in my .env, and the server restarts on a different port.

14:25:17 [vite] .env changed, restarting server...
[vite] connected.
14:25:18 [vite] Re-optimizing dependencies because vite config has changed
14:25:18 [vite] server restarted.
14:25:18 [vite]
14:25:18 [vite]   ➜  Local:   http://localhost:5173/

What's the expected result?

The server should've restarted on port 45345.

Link to Minimal Reproducible Example

NA

Participation

  • I am willing to submit a pull request for this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    - P4: importantViolate documented behavior or significantly impacts performance (priority)pkg: astroRelated to the core `astro` package (scope)

    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