sveltejs / svelte

Cybernetically enhanced web apps
https://svelte.dev
MIT License
78.19k stars 4.09k forks source link

Crashing when saving rollu.config.js #3528

Closed gdlazcano closed 5 years ago

gdlazcano commented 5 years ago

Describe the bug When you press ctrl+s, without changing anything, the application crashes

Logs

{ Error: listen EADDRINUSE: address already in use :::35729
    at Server.setupListenHandle [as _listen2] (net.js:1279:14)
    at listenInCluster (net.js:1327:12)
    at Server.listen (net.js:1414:7)
    at Server.listen (/home/gabriel/Workspace/my-svelte-project/node_modules/livereload/lib/livereload.js:80:28)
    at Object.exports.createServer (/home/gabriel/Workspace/my-svelte-project/node_modules/livereload/lib/livereload.js:246:14)
    at livereload (/home/gabriel/Workspace/my-svelte-project/node_modules/rollup-plugin-livereload/dist/index.cjs.js:19:29)
    at Object.<anonymous> (/home/gabriel/Workspace/my-svelte-project/rollup.config.js:48:20)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.require.extensions..js (/home/gabriel/Workspace/my-svelte-project/node_modules/rollup/dist/bin/rollup:838:24)
    at Module.load (internal/modules/cjs/loader.js:653:32)
  code: 'EADDRINUSE',
  errno: 'EADDRINUSE',
  syscall: 'listen',
  address: '::',
  port: 35729 }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! svelte-app@1.0.0 autobuild: `rollup -c -w`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the svelte-app@1.0.0 autobuild script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/gabriel/.npm/_logs/2019-09-07T19_44_19_736Z-debug.log
ERROR: "autobuild" exited with 1.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! svelte-app@1.0.0 dev: `run-p start:dev autobuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the svelte-app@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/gabriel/.npm/_logs/2019-09-07T19_44_19_778Z-debug.log

To Reproduce

npx degit sveltejs/template my-svelte-project
cd my-svelte-project

npm install
npm run dev

Open rollup.config.js and press ctrl+s

Conduitry commented 5 years ago

This isn't happening for me, and I don't remember anyone else ever reporting having this same error, so I would assume this is something environmental on your machine. Please come to the Discord chat server for support-related questions.

gdlazcano commented 4 years ago

Tested the same issue on Windows 10 and still happening. Uploaded a video in Discord support tab

quantuminformation commented 4 years ago

I started getting the same error with this config when running dev

{
  "name": "svelte-app",
  "version": "1.0.0",
  "devDependencies": {
    "babel-eslint": "^10.0.3",
    "eslint": "^6.4.0",
    "eslint-config-prettier": "^6.3.0",
    "eslint-plugin-prettier": "^3.1.1",
    "eslint-plugin-svelte3": "^2.7.3",
    "npm-run-all": "^4.1.5",
    "prettier": "^1.18.2",
    "prettier-plugin-svelte": "^0.7.0",
    "rollup": "^1.12.0",
    "rollup-plugin-commonjs": "^10.0.0",
    "rollup-plugin-livereload": "^1.0.0",
    "rollup-plugin-node-resolve": "^5.2.0",
    "rollup-plugin-svelte": "^5.0.3",
    "rollup-plugin-terser": "^5.1.2",
    "svelte": "^3.0.0"
  },
  "dependencies": {
    "netlify-identity-widget": "^1.5.5",
    "sirv-cli": "^0.4.4",
    "svelte-routing": "^1.4.0",
    "sweetalert2": "^8.17.6"
  },
  "scripts": {
    "build": "rollup -c",
    "autobuild": "rollup -c -w",
    "dev": "run-p start:dev autobuild",
    "start": "sirv public --single",
    "start:dev": "sirv public --single --dev --port 5006"
  }
}

svelte-app@1.0.0 dev /Users/nikos/WebstormProjects/svelte-netlify-fauna/temp/netlify-identity-demo-svelte
> run-p start:dev autobuild

> svelte-app@1.0.0 start:dev /Users/nikos/WebstormProjects/svelte-netlify-fauna/temp/netlify-identity-demo-svelte
> sirv public --single --dev --port 5006

> svelte-app@1.0.0 autobuild /Users/nikos/WebstormProjects/svelte-netlify-fauna/temp/netlify-identity-demo-svelte
> rollup -c -w

  Your application is ready~! 🚀

  - Local:      http://localhost:5006

────────────────── LOGS ──────────────────

Error: listen EADDRINUSE: address already in use :::35729
    at Server.setupListenHandle [as _listen2] (net.js:1226:14)
    at listenInCluster (net.js:1274:12)
    at Server.listen (net.js:1362:7)
    at Server.listen (/Users/nikos/WebstormProjects/svelte-netlify-fauna/temp/netlify-identity-demo-svelte/node_modules/livereload/lib/livereload.js:80:28)
    at Object.exports.createServer (/Users/nikos/WebstormProjects/svelte-netlify-fauna/temp/netlify-identity-demo-svelte/node_modules/livereload/lib/livereload.js:245:14)
    at livereload (/Users/nikos/WebstormProjects/svelte-netlify-fauna/temp/netlify-identity-demo-svelte/node_modules/rollup-plugin-livereload/dist/index.cjs.js:20:29)
    at Object.<anonymous> (/Users/nikos/WebstormProjects/svelte-netlify-fauna/temp/netlify-identity-demo-svelte/rollup.config.js:47:18)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
    at Object.require.extensions.<computed> (/Users/nikos/WebstormProjects/svelte-netlify-fauna/temp/netlify-identity-demo-svelte/node_modules/rollup/dist/bin/rollup:840:24)
    at Module.load (internal/modules/cjs/loader.js:641:32) {
  code: 'EADDRINUSE',
  errno: 'EADDRINUSE',
  syscall: 'listen',
  address: '::',
  port: 35729```

I updated deps and same issue.
rixo commented 4 years ago

That's a bug in rollup-plugin-livereload.

It should probably use the same kind of solution as rollup-plugin-serve (same author) to survive Rollup reloads. I stole it for rollup-plugin-hot.

But it's not.

gargleblaster commented 4 years ago

I'm suffering with this, and I don't understand @rixo 's comment above. Is there a fix? Is there a workaround?

rixo commented 4 years ago

@gargleblaster Like I said, bug in rollup-plugin-livereload. Already reported.

I've sent a PR to rollup-plugin-livereload.

I've also made a "dist" branch of the fix in the PR, that you can use while waiting for the merge (build files are excluded in normal branch).

For example:

yarn add -D rixo/rollup-plugin-livereload#fix-rollup-restart-dist

I've also pushed an example using this, on a branch of my live template. You can try it to see if the fix is working for you...

YerkoPalma commented 4 years ago

@rixo This doesn't seem to fix the issue. I've tried your branch and the error keeps the same

src/main.js → public/build/bundle.js...
Error: listen EADDRINUSE: address already in use :::35729
    at Server.setupListenHandle [as _listen2] (net.js:1279:14)
    at listenInCluster (net.js:1327:12)
    at Server.listen (net.js:1414:7)
    at Server.listen (C:\CLC\VIDA\Web\Comun\ypalma\mujeres-tea\node_modules\livereload\lib\livereload.js:80:28)
    at Object.exports.createServer (C:\CLC\VIDA\Web\Comun\ypalma\mujeres-tea\node_modules\livereload\lib\livereload.js:245:14)
    at livereload (C:\CLC\VIDA\Web\Comun\ypalma\mujeres-tea\node_modules\rollup-plugin-livereload\dist\index.cjs.js:27:25)
    at Object.<anonymous> (C:\CLC\VIDA\Web\Comun\ypalma\mujeres-tea\rollup.config.js:53:20)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.require.extensions.(anonymous function) (C:\CLC\VIDA\Web\Comun\ypalma\mujeres-tea\node_modules\rollup\dist\bin\rollup:831:24)
    at Module.load (internal/modules/cjs/loader.js:653:32)