Hugo v0.24 Ubuntu Server 17.04 - Error: exec: "nano": executable file not found in $PATH

I have a new install of Ubuntu Server 17.04 and Hugo v0.24.

When I attempt to create a new post with it editing in nano, I get the following error:

/home/user/site/content/post/blah.md created
Editing post/blah.md with "nano" ...
Error: exec: "nano": executable file not found in $PATH

My config is as follow:

baseURL = "site_removed"
languageCode = "en-us"
title = "Site Title"
newContentEditor = "nano"
pygmentsStyle = "native"
theme = "hugo-theme-cactus-plus"

I’ve verified nano is installed properly and I can use it to edit the file afterwards manually. The output of which nano is the following:

$ which nano
/bin/nano

echo $PATH verifies it is in fact there:

$ echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

I tried using an absolute path to nano in the config and was shown the same error. Any help would be greatly appreciated. Cheers.

Search the Ubuntu forums about placing nano on your PATH.

PS. i’m amazed that you use nano as a content editor. That’s like back to the 80s! LOL!

I find nano much easier to use than vim personally. I’ve tried both but for the little I do in Linux, it’s just easier to use.

I found this link to add it to the path, howver, nano is already in bin

$ whereis nano
nano: /bin/nano /usr/share/nano /usr/share/man/man1/nano.1.gz /usr/share/info/nano.info.gz

Attempting to create a symlink shows it’s already there:

$ sudo ln -s /usr/bin/nano /bin/nano
ln: failed to create symbolic link '/bin/nano': File exists

And is already added to my ~/.bashrc profile so it should be finding it upon a search

Just tested this in my Ubuntu 16.04 and you are right.

Hugo doesn’t find editors specified with newContentEditor that are already on the $PATH in Ubuntu.

This is something for @bep

EDIT
@Taubin are you using the Hugo snap on Ubuntu?

If yes, I have a hunch that your issue is related to this: https://github.com/gohugoio/hugo/issues/3143

I am, so that appears to be the issue. Using apt I get an earlier version, which is not compatible with some of the themes I’d like to use. I think I’ll try my hand at compiling it without snap or apt, should be a good learning experience.

Thank you again!

After installing hugo manually instead of using snap (or git) and it’s working properly now. Thank you very much for the help.

I see that I completely missed the warning on the install page, as I was in a bit of a hurry. Lesson learned!

1 Like

You’re welcome, @Taubin

@rdwatters The documentation needs to include this limitation about the Hugo Snap. You can rephrase it as you see appropriate.

When running the Hugo snap the user will not be able to run an external content editor specified in config.toml because of the snap security architecture. See the above Github issue as a well.

Duly noted. Thanks @alexandros

1 Like

I think I’ll ditch the Hugo snap also and go back to installing the .deb files as new versions come out.

The issue that really gets on my nerves is that whenever the snap gets updated hugo disappears from my $PATH for no reason and comes back whenever it feels like it.

The past 2 weeks this happened to me like 3 times already since there were new Hugo versions.

I understand that snap may be re-indexing itself or whatever, but there is no notification in Ubuntu. Nada!

Still I can override this problem by typing snap run hugo but why do I have to resort using an extra command?

I’ve looked everywhere for this snap issue and there is nothing anywhere…

Hugo 0.25.1 has finally landed in Debian! See https://packages.debian.org/sid/hugo, or use apt-get update && apt-get install hugo to install it, if you are using Debian sid.

Ubuntu “artful” (the future 17.10) users should see it soon too.

Special thanks to Debian Developer Dr. Tobias Quathamer who has packaged up Hugo’s new dependencies such as golang-golang-x-image and golang-github-chaseadamsio-goorgeous. He has saved me a lot of work in getting the new package ready for Debian sid/buster.

1 Like