How to change the default port of a Svelte.js app

Last updated on Sep 7, 2020 by Suraj Sharma

In this tutorial, you will learn how you can change the default development server port 5000 of Svelte.js app to a port of your choice.

You can explicitly define a port on our terminal when starting a development server like

PORT=3400 npm run dev

If you don’t want to define the port number every time you run the development server then the best option would be to update your start script in the package.json file.

Instead of :

"start": "sirv public"

Use :

"start": "sirv public --port 3400"


"start": "sirv public -p 3400"

add script in package.json

Next time when you run the command npm run dev, your Svelte app is hosted on


running svelte app locally

Related Solutions

Rate this post

Suraj Sharma is a Full Stack Software Engineer. He holds a B.Tech degree in Computer Science & Engineering from NIT Rourkela.