[SOLVED] Can't connect to localhost:1313 (macOS Mojave)


#1

Hi,
I can’t connect to localhost:1313 on my mac. Localhost works but localhost:1313 refuses to work. Hugo is running in terminal just fine and generates the site, I was able to upload my site to my webhosting, but locally I can’t see the site. Can you please help? I was trying to disable my firewall, but it did not help.
Thank you.
Lukáš


#2

Has nothing to do with Mojave. I’m on Mojave since release and no probs with Hugo. Did you try to find out whether there’s another process running which is blocking 1313? Here’s the terminal command:

ps -ax | grep hugo

If it shows the processes you can kill them by ID.

Hope this helps.


#3

In addition to @Leo_Merkel’s tip, you can also see which process is currently using port 1313 with

lsof -i tcp:1313

#4

Thank you!

When I do this command:

ps -ax | grep hugo

I got the output like this:

5758 ttys001 0:00.01 grep hugo

The process cannot be terminated, the ID is actually changing:

-bash: kill: (5758) - No such process

Would you know about any other way how to find out what could cause the blocking of localhost:1313?


#5

Thank you, when I do this command:

lsof -i tcp:1313

I got no output, so I guess there is no other process running on 1313.

I tried a different browser and the output is still the same even the Hugo generates the site in the terminal: it can’t connect to the server. When I try just the localhost, it says “It works!” :slight_smile: but localhost:1313 is not…


#6

I’m running on MacOS Mojave and just wanted to confirm that I am not seeing this.
Are you running some other software that might block ports, like an anti-virus or something like Little Snitch?

You can use “Network Utility” to scan a range of ports, to see what is running on them. But, it might make an assumption about what is “supposed” to be running. If you have hugo shut down, and you scan the ports and find something on 1313, then you know. If you have hugo running and you find something on there, it won’t say “hugo” but rather whatever it thinks should be there. In the case of the screenshot, it’s finding netware-csp and dcs on my hugo ports.


#7

Just to rule it out, are you running hugo server with no other options?


#8

That was the case… :blush: Thank you @RickCogley, @zwbetz and @Leo_Merkel for your help! If there is anything I could do for you to pay you back, just let me know. Well, probably not with Hugo :blush: but still…


#9

You’re always welcome, @lukylab. When I started with Hugo, this community gave me a lot and so I’m happy to give back a little. Your payback is that you got Hugo working.

Take care.


#10

Glad to help.

Out of curiosity, what did you end up doing to fix the issue?


#11

Thank you…


#12

I forgot to add the magic word “server”… I did run just command “hugo”… :blush: It hit me when I saw the screenshot from @RickCogley


#13

As a side note, if the default port is used, hugo server is smart enough to use a different, unused port.

You can test this yourself by running hugo server in two separate console windows.


#14

Just tried it, excellent, thanks a lot!