Search code examples
sveltelivereload

Run 2 Svelte project simuletanelously


I tried running two svelte projects using npm run dev, however the second one gives the error Error: listen EADDRINUSE: address already in use :::35729.

I have looked online for a solution with no avail.

Where can i modify this configuration to select another port.


Solution

  • Judging by the code of rollup-plugin-livereload, you can assign a port.

    In your rollup.config.js file,
    Change:
    !production && livereload('public'),
    to
    !production && livereload({watch: 'public', port: 35730}),

    It seems rollup-plugin-livereload automatically assigns to port 35729 and prints the error if it is already in use.

    Though, it uses port-authority which I thought would automagically find an open port, but anyway, the above change to your rollup.config.js should hopefully still solve your problem.

    I have not actually tested this, but I would expect it to work.