Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 BUG: Ports are not auto-assigned for devPort and hmrPort when starting two dev servers #897

Closed
jasikpark opened this issue Jul 27, 2021 · 4 comments

Comments

@jasikpark
Copy link
Contributor

What package manager are you using?

yarn

What operating system are you using?

Mac

Describe the Bug

I thought this was already sorted, but I got this error when I was running yarn workspace docs start in astro and yarn start in an starter project outside of the repo:

✗  yarn start
yarn run v1.22.10
$ astro dev
[18:46:27] [snowpack] Hint: run "snowpack init" to create a project config file. Using defaults...
[18:46:37] [snowpack] Ready!
node:events:371
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE: address already in use :::12321
    at Server.setupListenHandle [as _listen2] (node:net:1315:16)
    at listenInCluster (node:net:1363:12)
    at Server.listen (node:net:1450:7)
    at new WebSocketServer (/private/var/folders/9r/wd2vc1h90f97jzm2xxd754qw0000gn/T/tmp.pLhRyhMz/node_modules/ws/lib/websocket-server.js:90:20)
    at new EsmHmrEngine (/private/var/folders/9r/wd2vc1h90f97jzm2xxd754qw0000gn/T/tmp.pLhRyhMz/node_modules/snowpack/lib/cjs/hmr-server-engine.js:24:15)
    at Object.startHmrEngine (/private/var/folders/9r/wd2vc1h90f97jzm2xxd754qw0000gn/T/tmp.pLhRyhMz/node_modules/snowpack/lib/cjs/dev/hmr.js:14:23)
    at startServer (/private/var/folders/9r/wd2vc1h90f97jzm2xxd754qw0000gn/T/tmp.pLhRyhMz/node_modules/snowpack/lib/cjs/commands/dev.js:801:17)
    at async createSnowpack (file:///private/var/folders/9r/wd2vc1h90f97jzm2xxd754qw0000gn/T/tmp.pLhRyhMz/node_modules/astro/dist/runtime.js:321:14)
    at async createRuntime (file:///private/var/folders/9r/wd2vc1h90f97jzm2xxd754qw0000gn/T/tmp.pLhRyhMz/node_modules/astro/dist/runtime.js:341:7)
    at async dev (file:///private/var/folders/9r/wd2vc1h90f97jzm2xxd754qw0000gn/T/tmp.pLhRyhMz/node_modules/astro/dist/dev.js:17:19)
Emitted 'error' event on WebSocketServer instance at:
    at Server.emit (node:events:394:28)
    at emitErrorNT (node:net:1342:8)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  code: 'EADDRINUSE',
  errno: -48,
  syscall: 'listen',
  address: '::',
  port: 12321
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Steps to Reproduce

  1. clone astro
  2. yarn workspace docs start and yarn workspace www start
  3. Error!

Link to Minimal Reproducible Example (Optional)

the astro repo 😆

@matthewp
Copy link
Contributor

This was fixed here: #695

@jasikpark
Copy link
Contributor Author

jasikpark commented Aug 27, 2021

Screen Shot 2021-08-27 at 6 22 08 PM

That does not seem to be the case when testing with two astro projects: jasikpark/astro-katex and snowpackjs/astro/www, both of which are on astro@latest

@jasikpark jasikpark reopened this Aug 27, 2021
@mihkeleidast
Copy link
Contributor

sindresorhus/get-port#56 got merged today, which will maybe (🤞 ) fix this issue.

@natemoo-re
Copy link
Member

This should definitely be fixed now in v0.21, but please feel free to reopen if this issue persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants