rixo / rollup-plugin-svelte-hot

Fork of official rollup-plugin-svelte with added HMR support (for both Nollup or Rollup)
MIT License
47 stars 6 forks source link

Port already in use #3

Open antony opened 4 years ago

antony commented 4 years ago

So, apologies for the next bug report, since it's another mystery one.

 ✘ ant@xeno  ~/Projects/beyonk-pwa   feature/hmr ●  npm run dev  

> beyonk-pwa@6.0.0 dev /home/ant/Projects/beyonk-pwa
> NODE_OPTIONS=--max-old-space-size=4096 NODE_CONFIG_ENV=${NODE_ENV} PORT=1234 sapper dev

Building for environment development.
[HMR] Listening on port 45361
[HMR] Serving from RAM at http://127.0.0.1:45361
Browserslist: caniuse-lite is outdated. Please run next command `npm update`
✔ client (1m03s)
✔ server (1m03s)
> Listening on http://localhost:1234
✔ service worker (91ms)
events.js:282
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE: address already in use :::1234
    at Server.setupListenHandle [as _listen2] (net.js:1308:16)
    at listenInCluster (net.js:1356:12)
    at Server.listen (net.js:1444:7)
    at Polka.listen (/home/ant/Projects/beyonk-pwa/node_modules/polka/index.js:66:22)
    at Object.<anonymous> (/home/ant/Projects/beyonk-pwa/__sapper__/dev/server/server-41b2c55f.js:35278:5)
    at Module._compile (internal/modules/cjs/loader.js:1139:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1159:10)
    at Module.load (internal/modules/cjs/loader.js:988:32)
    at Function.Module._load (internal/modules/cjs/loader.js:896:14)
    at Module.require (internal/modules/cjs/loader.js:1028:19)
Emitted 'error' event on Server instance at:
    at emitErrorNT (net.js:1335:8)
    at processTicksAndRejections (internal/process/task_queues.js:84:21) {
  code: 'EADDRINUSE',
  errno: -98,
  syscall: 'listen',
  address: '::',
  port: 1234
}
> Server crashed

I run my Sapper app on a custom port (1234), by passing in the PORT variable.

However, it would seem that using the HMR plugin + config, I get port in use errors and my server immediately crashes. I'm still investigating why, and will update if I find any useful information.

Noteworthy is that if I modify server.js afterwards causing it to recompile, the server does seem to start-up successfully (whether it works is another matter).

antony commented 4 years ago

Looks like the HMR plugin is doing something, since this is in my console:

[HMR] Enabled
sapper-dev-client.js:10 [SAPPER] dev client: bails out in favor of Rollup HMR
...
client.js:237 [HMR] Rebuilding...
client.js:218 [HMR] Apply changes...
client.js:168 [HMR] Up to date
client.js:237 [HMR] Rebuilding...
client.js:218 [HMR] Apply changes...
client.js:168 [HMR] Up to date

But I'm definitely getting full reloads, still.

ejoflo commented 3 years ago

Browserslist: caniuse-lite is outdated. Please run next command npm update ✔ client (1m03s) ✔ server (1m03s)

Listening on http://localhost:1234 ✔ service worker (91ms)

Apologies for the off-topic question. I've been searching Google for anything involving a similar notification you received above:

Browserslist: caniuse-lite is outdated. Please run: npx browserslist@latest --update-db

I know Sapper is currently not being updated, however is this Browserlist update something I need to be concerned about or shall I just ignore it? Thanks for any insight.