Web Server is available at //localhost:24439?

Suddenly today I see random server ports rather than the familiar :1313/

Why is that?

Not a major issue, just didn’t happen before and it’s a new port every time I restart.

Most likely the hugo process is already running.

If there is an instance of the local server running and another one is initiated, then the second instance receives a random address.

Have a look at your activity monitor.

1 Like

On a linux system run:

killall -9 hugo

and retry.

On Windows: “Did you reboot yet?”

I am on Windows, and when this happens I have another instance of hugo.exe running.

I have tailwind 3.0 running at the same time and I guess the Ctrl+c stops Tailwind, but not Hugo Server. Not really a major issue, I can stopp the hugo.exe manually. Also it’s not happening all the time.

    "start": "concurrently npm:watch:*",
    "watch:tw": "tailwindcss -i ./assets/css/main.css -o ./assets/css/style.css --watch",
    "watch:hugo": "hugo server",
    "build": "hugo --minify"

That basically is the explanation why another port is used. A port can only be used by one single instance of a program. That’s a limit of the concept of ports. Start hugo twice and the second instance selects a different port. If you want to rule what port to use check the documentation about CLI parameters. There is one (probably --port, but I didn’t check) that allows you to define which port hugo uses.

Stopping your concurrent runs should stop both tailwind and hugo. If in doubt, you can create a shellscript for hugo that you call via watch:hugo and that explicitly kills all instances on CTRL-C. I don’t know how to do that for Windows, here is my Linux line:

trap "{ killall -9 hugo; }" SIGINT
# then run hugo
hugo server...