Skip to content

svelte-kit dev does not recognize occupied ports on Windows #948

@emme1444

Description

@emme1444

Describe the bug
When running svelte-kit dev, on Windows, SvelteKit does not throw an error for an already occupied port. Instead what happens is SvelteKit prints the "welcome" message, when trying to reach the started dev server it is of course shadowed by the process already occupying that port.

To Reproduce

On a Windows machine:

  1. Make sure some service is running on port 3000.
  2. Make a new directory and cd into it.
  3. npm init svelte@next
  4. npm i
  5. npm run dev ⬅ This should throw, but doesn't!

Expected behavior

An error should be thrown to indicate that the port the dev server is trying to launch on is already in use by another process.

Information about your SvelteKit Installation:

Diagnostics
  • The output of npx envinfo --system --npmPackages svelte,@sveltejs/kit,vite --binaries --browsers
  System:
    OS: Windows 10 10.0.19042
    CPU: (4) x64 Intel(R) Core(TM) i5-4460  CPU @ 3.20GHz 
    Memory: 16.23 GB / 23.92 GB
  Binaries:
    Node: 14.15.4 - C:\Program Files\nodejs\node.EXE      
    Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD        
    npm: 6.14.10 - C:\Program Files\nodejs\npm.CMD        
  Browsers:
    Chrome: 89.0.4389.114
    Edge: Spartan (44.19041.423.0), Chromium (89.0.774.75)
    Internet Explorer: 11.0.19041.1
  npmPackages:
    @sveltejs/kit: next => 1.0.0-next.71
    svelte: ^3.29.0 => 3.37.0
    vite: ^2.1.0 => 2.1.5

Severity

Mildly annoying, but for many users nonetheless.

Additional context
I poked around in the source for the svelte-kit cli. I noticed that you guys use the port-authority package's blame function. According to the port-authority documentation, under Additional functions, this function only supports Unix-like operating systems.

Maybe a better fix is for this, would be to add support for this in port-authority, just thought this should be tracked.

Thanks for this awesome framework!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions