`svelte-kit dev` does not recognize occupied ports on Windows
See original GitHub issueDescribe 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:
- Make sure some service is running on port
3000
. - Make a new directory and
cd
into it. npm init svelte@next
npm i
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!
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (5 by maintainers)
Top GitHub Comments
Ok, it sounds like there isn’t anything you want to be fixed still then, so I’ll go ahead and close this
@Cheetah0723 Please ask around discord for support questions. GitHub issues is not the place for it.