ERROR: 2017/05/30 02:26:24 server.go:121: port 1313 already in use, attempting to use an available port

ERROR: 2017/05/30 02:26:24 server.go:121: port 1313 already in use, attempting to use an available port

Your rendered home page is blank: /index.html is zero-length

  • Did you specify a theme on the command-line or in your
    "config.toml" file? (Current theme: “”)
  • For more debugging information, run “hugo -v”
    =============================================================
    0 of 1 draft rendered
    0 future content
    0 pages created
    0 non-page files copied
    0 paginator pages created
    0 tags created
    0 categories created
    in 11 ms
    Watching for changes in /home/sreebash/Desktop/Hugo/Personal_Blog/{data,content,layouts,static}
    Serving pages from memory
    Web Server is available at http://localhost:46527/ (bind address 127.0.0.1)
    Press Ctrl+C to stop

How to fixed it ?
Thanks in advanced!
:slightly_smiling:

Have you checked to make sure you’re not running another copy of hugo?

I am newbie here. I don’t know clearly what is happen ?

What do you mean by another copy of hugo ??

You can run multiple instances of Hugo simultaneously, i.e. you can run Hugo for multiple websites at once. Each running Hugo instance is associated with a port. website A is served by default over port 1313. If you want to serve website B Hugo starts a server for this website as well. However, Hugo will fail to use the default port 1313, because it’s already used for website A.

But this often happens by accident. On *nix (i.e. Linux, macOS etc.) a pkill hugo in terminal will do the trick. On Windows you would have to open “Process explorer” (or whatever it is called), and kill the “hugo.exe” process.

Got it !
Thanks :slightly_smiling:

Thanks! I am on Linux . Windows is like a fake girl. :smiley:

Run something like:

 ps aux | grep hugo

… to find the hugo commands that are running, and then use pkill or kill etc on the names or pid’s, to kill the ones you don’t need. The default is port 1313, so if you run it again, hugo will try to use 1313 again and fail, because you haven’t killed the previous.

Secondly it appears you have not specified a theme, so, you should do that to avoid the error about the missing index.

Got it ! Thanks :slight_smile:

I will share some recent experience with that issue.

Just for a matter of curiosity, I installed the demo-hugo-site from the snap store in ubuntu, and I didn’t imagine that this snap runs automatically taking the 1313 port as hugo does by default.

I figured it out looking for used ports and the associated application:

sudo lsof -i :1313

That command shows something like this:

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
static-we 22463 root 3u IPv6 130991 0t0 TCP *:xtel (LISTEN)

But xtel is not installed, and what the heck is static-we command?.
Then, I ran:

ps aux|grep static-we

That shows the forgotten running program:

root 22791 0.0 0.0 111996 5848 ? Ssl 16:43 0:00 static-webserver -dir /snap/demo-hugo-site/22/public -port 1313

There you have it. If you or someone else have this snap or package installed, just uninstall it.