Run 2 Svelte project simuletanelously

Viewed 930

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.

2 Answers

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.

I removed my previous answer, since I didn't understand the problem was with the livereload port, not the web server port.

I just tested in my system with a new fresh svelte project, and pre-opened a webserver in the port 35729, and svelte automatically changed its livereload port to 35730

Related