0.9.1 Hugo runtime error linux

I installed caddy from caddyserver.com, with the hugo plugin.
caddy runs fine without hugo enabled in the caddyfile
once i use hugo I get panic: runtime error: index out of range
been trying to make it work for hours now, i even destroyed my digitalocean distance and tried it out on vultr. still a no go

i looked at the other thread and there’s still no solution for me. my $GOPATH is ~/go and my $PATH is etc/environment appended with $GOPATH/bin. so i believe my paths are fine

Here’s the error in detail

$ caddy
Activating privacy features...
Your sites will be served over HTTPS automatically using Let's Encrypt.
By continuing, you agree to the Let's Encrypt Subscriber Agreement at:
  https://acme-v01.api.letsencrypt.org/terms
Please enter your email address so you can recover your account if needed.
You can leave it blank, but you'll lose the ability to recover your account.
Email address: [redacted]
 done.
Unable to find Hugo on your computer.
Hugo installed at /[redacted]/.caddy/bin/hugo

$ caddy
Activating privacy features... done.
panic: runtime error: index out of range

goroutine 1 [running]:
panic(0xbf4b60, 0xc42000a100)
        /usr/local/go/src/runtime/panic.go:500 +0x1a1
github.com/hacdias/caddy-hugo.checkVersion(0xc42027b000, 0x15, 0x15609a0)
        /home/caddy/go/src/github.com/hacdias/caddy-hugo/installer.go:95 +0x15b
github.com/hacdias/caddy-hugo.getPath(0xc811a0, 0xc4202622a0)
        /home/caddy/go/src/github.com/hacdias/caddy-hugo/installer.go:50 +0x67c
github.com/hacdias/caddy-hugo.parse(0xc4200887e0, 0xccd3bc, 0x1, 0x530f33, 0x15ecda8, 0x1)
        /home/caddy/go/src/github.com/hacdias/caddy-hugo/setup.go:144 +0x13a
github.com/hacdias/caddy-hugo.setup(0xc4200887e0, 0x4, 0xcce38d)
        /home/caddy/go/src/github.com/hacdias/caddy-hugo/setup.go:36 +0xb7
github.com/mholt/caddy.executeDirectives(0xc420260f70, 0xcd398a, 0x9, 0x15f55e0, 0x26, 0x26, 0xc4202640c0, 0x1, 0x1, 0x0, ...)
        /tmp/custombuild_7685_123976589/src/github.com/mholt/caddy/caddy.go:557 +0x597
github.com/mholt/caddy.startWithListenerFds(0x155aec0, 0xc4202074c0, 0xc420260f70, 0x0, 0x64, 0x0)
        /tmp/custombuild_7685_123976589/src/github.com/mholt/caddy/caddy.go:455 +0x39a
github.com/mholt/caddy.Start(0x155aec0, 0xc4202074c0, 0x155aec0, 0xc4202074c0, 0x0)
        /tmp/custombuild_7685_123976589/src/github.com/mholt/caddy/caddy.go:423 +0xff
github.com/mholt/caddy/caddy/caddymain.Run()
        /tmp/custombuild_7685_123976589/src/github.com/mholt/caddy/caddy/caddymain/run.go:115 +0x26b
main.main()
        /tmp/custombuild_7685_123976589/src/github.com/mholt/caddy/caddy/main.go:13 +0x1b

I would really love to use hugo with caddy. thank you :slight_smile:

It still looks like its a $PATH issue to me. What do you get when you run which hugo?

In my case that output wasn’t what I was expecting and I had to add

export PATH="mypath/with/the/binary/install/hugo:$PATH"

to the file .bash_profile.

FYI, @hacdias tells me that it’s fixed but I need to update it on the build server. There are some technical complications there, and I am not sure how quickly I will be able to update it.

1 Like

I’m sorry, yall. It was my fault, I didn’t install hugo. I thought caddy-hugo would install hugo, but I found out I had to install hugo myself, oops!

I had to install hugo myself too, but I remember reading somewhere no Caddyserver site that hugo is baked into Caddy server itself. Can you please confirm if this is false @matt ?

It’s not; like the git plugin, it requires the external hugo binary to be installed in the PATH.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.