Hugo installed with a snap doesn't work

I found a very nice theme for hugo but it require at least the version 0.2 to work. I use Ubuntu 17.04 and I decided to install hugo via snap as told in the docs. Sadly when I write hugo on the terminal it doesn’t work as if the software isn’t installed. Am I the only one to have this problem? Did I mistake something?
It seem to work just if I write in terminal “snap run hugo”.

1 Like

I haven’t tried the snap pacakge, but if it is showing you an error message it means hugo isn’t in your path. I’d look up that error and try to track that down.

Also note the snap install warning:

Hugo-as-a-snap can write only inside the user’s $HOME
directory—and gvfs-mounted directories owned by the user—because of
Snaps’ confinement and security model. More information is also
available in this related GitHub issue.

Doesn’t sound like your issue, but keep it in mind while looking for a solution. :slight_smile:

1 Like

@anthonyfok may help – we have a little bit too fragmented release process, we try to improve on this, but the snap and the brew builds currently depends on “a person to push a button” – not sure if the Snap is updated or not for 0.20.

On Ubuntu 16.04 the Hugo Snap is v.0.20.6

Hi @surveyor3!

Sadly when I write hugo on the terminal it doesn’t work as if the software isn’t installed. Am I the only one to have this problem? Did I mistake something?
It seem to work just if I write in terminal “snap run hugo”.

Sorry for my late reply! Were you able to solve your problem?

If "snap run hugo" works for you, but plain "hugo" doesn’t, it means that you have multiple copies of the hugo binary installed on your system.

Please try the following command:

whereis hugo

And you might see something like this:

hugo: /usr/local/bin/hugo /snap/bin/hugo

which means there is another, likely older, copy of Hugo installed under /usr/local/bin.

Why does snap run hugo work? snap run forces running the binary inside /snap/bin.

Try these commands also:

$ hugo env
$ snap run hugo env

and you’ll likely see different outputs, e.g.:

$ hugo env
Hugo Static Site Generator v0.20.7 linux/amd64 BuildDate: 2017-05-03T01:39:25-06:00
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.8.1"

$ snap run hugo env
Hugo Static Site Generator v0.21 linux/amd64 BuildDate: 2017-05-24T14:12:22-06:00
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.8.1"

In my case, I have an older hugo .deb installed, so what I would do on my own system is to run

$ sudo dpkg --purge hugo

to get rid of the old copy.

Alternatively, you may also fetch the latest .deb package from Releases · gohugoio/hugo · GitHub

Hope this helps!

Anthony

I solved the problem thank to putting an alias huno=‘snap hugo’

Something bizarre happened today. I also use the hugo snap on Ubuntu 16.04 and earlier today my system couldn’t find Hugo installed, even though I didn’t do anything out of the ordinary. I had to leave and put the laptop on suspend, then came back after a few hours and Hugo is working again.

Any ideas of what might cause this strange behavior @anthonyfok ?

If it’s helpful at all here is the output of hugo env

Hugo Static Site Generator v0.21 linux/amd64 BuildDate: 2017-05-24T23:12:22+03:00
GOOS=“linux”
GOARCH=“amd64”
GOVERSION=“go1.8.1”

whereis hugo

hugo: /snap/bin/hugo

And snap run hugo env

Hugo Static Site Generator v0.21 linux/amd64 BuildDate: 2017-05-24T23:12:22+03:00
GOOS=“linux”
GOARCH=“amd64”
GOVERSION=“go1.8.1”

EDIT
I do not have the apt version of Hugo installed. Only the snap. And it ran without hiccup since last October.

Hi @alexandros,

I am not entirely sure what happened.
Perhaps snapd the Snap daemon was silently upgrading or "refresh"ing the hugo and core snaps in the background?

Ok. Thanks. I hasn’t happened since.

I have installed Hugo on Ubuntu 16.04.03 and I only get a flash when I try to launch it.
The flash seems to show a link to the terminal.

I also tried to install NVU and Kompozer but nothing happened.
Linux cannot find the location of these downloads.

I really don’t understand why Ubuntu keeps using all these difficult definitions and tricks to achieve something.

Feels like most users prefer to feel special knowing and understanding all these definitions.
I am waiting for the moment that Ubuntu decides to be understandable for any newby like me but it already took me a few years.

Hi @Frank_de_Wit:

Sorry, I haven’t been away for a bit and didn’t see your message till today.
Were you trying to install Hugo as a Snap? Or as a deb package from GitHub? Or via apt-get install hugo?

Is your problem resolved now?

I’m using Linux Mint 18.3. and I use sudo snap install hugo to install hugo.
After installed, I found hugo command not work.This means hugo not in system’s $PATH.
As mentioned before, I add export PATH=/snap/bin/:$PATH to my .bashrc and .zshrc.

now everything works fine.

1 Like

hugo version 0.32.2 is not working after snap install.
> snap run hugo env
> Hugo Static Site Generator v0.32.2 linux/amd64 BuildDate: 2018-01-03T11:22:53+01:00
> GOOS=“linux”
> GOARCH=“amd64”
> GOVERSION=“go1.9.2”

and with whereis hugo
hugo:

any advice how to make it worked?

The snap is working alright because it’s what I use.

First you check if Hugo is installed with hugo version not whereis

Then if it’s really not there try sudo snap refresh hugo Sometimes the snap needs refreshing.

If it’s still missing issue the command snap find hugo to look for it in the snap repositories and then install it with sudo snap install hugo

1 Like

Thanks, works now.