Running svelte dev on server Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Running svelte dev on server without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I am running svelte like this on my server:

$ npm run dev

  Your application is ready~! 🚀

  - Local:      http://localhost:5000

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

Which is great. However, when I try to access through my public ip, the bundle is not found. I.E. When I type <publicIP>:5000 into the browser. It doesn’t show up. The port is open and accessible. Is there any way to achieve this?

The request just fails. But shouldn’t it work if it’s running on localhost:5000? I have set up a node server and I can indeed access it on port 5000, but it doesn’t serve the files properly like npm run dev does.


Declare the environment variable HOST=

HOST= npm run dev

inspiration / possible source:

You can also modify the dev script in the package.json and prepend HOST=

  "scripts": {
    "build": "rollup -c",
    "dev": "HOST= rollup -c -w",
    "start": "sirv public"

And now you can simply run npm run dev

We are here to answer your question about Running svelte dev on server - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji