Installed hugo. Installed template. But localhost:1313 BLANK or ERROR

Love Hugo!

But I can’t get forward on the installation:

It doesn’t show on the localhost. Just blank. Have installed several times. Have also followed the video tutorials and the documentation of instaling Hugo what it seems fine.

Have wrote on the config.file the theme = “hugo-dream-plus” the theme that I want to install.
Have changed the baseUrl in diferent ways. But it doesn’t look in the tutorials as relevant so I left it like by default.
Have moved posts from the theme into quickstart/content. Nothing.

It seems there is a deprecated error .Hugo what it seems to come from the theme files (if I’m not wrong)

Here the code:

root@user:/usr/local/bin/quickstart# hugo server
Building sites … WARN 2019/05/20 20:56:57 Page's .Hugo is deprecated and will be removed in a future release. Use the global hugo function.
ERROR 2019/05/20 20:56:57 render of "home" failed: execute of template failed: template: index.html:11:5: executing "index.html" at <partial "background.html" .>: error calling partial: "/usr/local/bin/quickstart/themes/dream-plus/layouts/partials/background.html:23:11": execute of template failed: template: partials/background.html:23:11: executing "partials/background.html" at <len $bgList>: error calling len: len of untyped nil
ERROR 2019/05/20 20:56:57 render of "taxonomyTerm" failed: execute of template failed: template: taxonomy/terms.html:11:5: executing "taxonomy/terms.html" at <partial "background.html" .>: error calling partial: "/usr/local/bin/quickstart/themes/dream-plus/layouts/partials/background.html:23:11": execute of template failed: template: partials/background.html:23:11: executing "partials/background.html" at <len $bgList>: error calling len: len of untyped nil
ERROR 2019/05/20 20:56:57 render of "taxonomyTerm" failed: execute of template failed: template: taxonomy/terms.html:11:5: executing "taxonomy/terms.html" at <partial "background.html" .>: error calling partial: "/usr/local/bin/quickstart/themes/dream-plus/layouts/partials/background.html:23:11": execute of template failed: template: partials/background.html:23:11: executing "partials/background.html" at <len $bgList>: error calling len: len of untyped nil
ERROR 2019/05/20 20:56:57 render of "page" failed: execute of template failed: template: posts/single.html:11:5: executing "posts/single.html" at <partial "background.html" .>: error calling partial: "/usr/local/bin/quickstart/themes/dream-plus/layouts/partials/background.html:23:11": execute of template failed: template: partials/background.html:23:11: executing "partials/background.html" at <len $bgList>: error calling len: len of untyped nil
Total in 27 ms
Error: Error building site: failed to render pages: render of "section" failed: execute of template failed: template: posts/section.html:11:5: executing "posts/section.html" at <partial "background.html" .>: error calling partial: "/usr/local/bin/quickstart/themes/dream-plus/layouts/partials/background.html:23:11": execute of template failed: template: partials/background.html:23:11: executing "partials/background.html" at <len $bgList>: error calling len: len of untyped nil
root@user:/usr/local/bin/quickstart# hugo server
Error: "/usr/local/bin/quickstart/themes/hugo-dream-plus/layouts/partials/header.html:12:1": parse failed: template: partials/header.html:12: malformed character constant: 'popTagsCategories'
Expected behavior
Just want to see it on localhost:1313

Additional context:
I’m using Linux and followed the Debian installing.

Hugo version:
Hugo Static Site Generator v0.55.6-A5D4C82D linux/amd64 BuildDate: 2019-05-18T07:56:30Z

Any help would be really appreciated. Many thanks!

And, congrats!!

I recommend that you do both of the following.

  1. Do not run the hugo server command as root, instead run it as a regular user.
  2. Do not put your Hugo site in /usr/local/bin. Instead put it in a subdirectory of your home, for example, put it in ~/quickstart.

Note that ~ means $HOME in most shells, including Windows PowerShell.

Hard to say what is wrong. We need some more info to be able to help you, so please have a look at Requesting Help and provide some more details, like your repo? That way, it is easier to help you. Thanks.

1 Like

Thank you so much for the help! I’m gonna try all what you suggest. Thanks a lot!

I just wonder why then in the documentation they tell to do those kind of things that at the end are wrong. Even some tutorials are just incomplete and I am totally fine because it helps to learn and it is even for free so it is really appreciated. But often I get ‘please read the documentation’ but many times it is incomplete or just not updated.

Any way. Let’s see how far I get :sweat_smile:

Maybe start a new project. After adding the theme to the theme folder, look into the theme’s example directory. Copy the content of that directory into the root of your new project. Now hugo serve should work. It is always a good idea to bootstrap things using the example from the theme to get a first, working version.

I don’t know if the documentation is wrong, but from what you posted, I’m wondering if there is some kind of permission problem. What I suggested is standard practice(*) and might help with a permission problem (if that is what the problem is). Another thing that could help with a permission issue is to reinstall Hugo using a package manager (assuming you did not use a package manager already?).

(*) I don’t currently spend much time on a Linux machine, but back in the days that I did it was standard practice to 1) minimize the things you do as root and 2) put your user files under your home directory. Is that still standard practice in the Linux world?:confused:

1 Like

Hi everyone,

Thanks a lot for your time. really appreciated :pray:

I’ve started from scratch. Uninstalled all and reinstalled all following the video tutorials, github readme, hugo website, documentation,…

Went to /home created the folder zaesarpo there are all my files plus the theme included on the themes folder:

Now I get this error message when I want to start hugo server:

zaesar@zaesar-X541UV:/home/zaesarpo$ sudo hugo server
[sudo] contraseña para zaesar: 
Building sites … WARN 2019/05/23 15:24:22 Page's .Hugo is deprecated and will be 
removed in a future release. Use the global hugo function.
ERROR 2019/05/23 15:24:22 render of "taxonomyTerm" failed: execute of template failed: 
template: taxonomy/terms.html:11:5: executing "taxonomy/terms.html" at <partial 
"background.html" .>: error calling partial: "/home/zaesarpo/themes/hugo-dream-plus- 
master/layouts/partials/background.html:23:11": execute of template failed: template: 
partials/background.html:23:11: executing "partials/background.html" at <len $bgList>: error 
calling len: len of untyped nil
ERROR 2019/05/23 15:24:22 render of "home" failed: execute of template failed: template: 
index.html:11:5: executing "index.html" at <partial "background.html" .>: error calling partial: 
"/home/zaesarpo/themes/hugo-dream-plus-master/layouts/partials/background.html:23:11": 
execute of template failed: template: partials/background.html:23:11: executing 
"partials/background.html" at <len $bgList>: error calling len: len of untyped nil
Total in 14 ms
Error: Error building site: failed to render pages: render of "taxonomyTerm" failed: execute 
of template failed: template: taxonomy/terms.html:11:5: executing "taxonomy/terms.html" at 
<partial "background.html" .>: error calling partial: "/home/zaesarpo/themes/hugo-dream- 
plus-master/layouts/partials/background.html:23:11": execute of template failed: template: 
partials/background.html:23:11: executing "partials/background.html" at <len $bgList>: error 
calling len: len of untyped nil

Still the same problem with deprecated :roll_eyes:

I’m lost.

Here’s another idea: see if you can run the example site of the theme

git clone https://github.com/UtkarshVerma/hugo-dream-plus.git
cd hugo-dream-plus/exampleSite/
hugo server --themesDir ../.. --theme hugo-dream-plus

I’m using Hugo 0.55.6 and I get the following warnings

WARN 2019/05/23 08:53:44 Page's .Hugo is deprecated and will be removed in a future release. Use the global hugo function.
WARN 2019/05/23 08:53:44 Page's .UniqueID is deprecated and will be removed in a future release. Use .File.UniqueID.

Yet the example site still builds. So I would suggest firstly to upgrade your Hugo version


Well nevermind, I see you’re using the latest Hugo version already…

Yay that you are in your home directory, but boo that you are using sudo.:slightly_frowning_face: You need to do the following:

  1. Do not use sudo, simply run hugo server.
  2. Be in the directory that contains the config.toml file of your site. This is probably not /home/zaesarpo. It will be something like /home/zaesarpo/sitename. (*)

What Hugo documentation are you using? I recommend that you find some Hugo documentation that does not tell you to use sudo hugo server. Also, rather than using a theme that you like (which you can do later), use a theme that the Hugo documentation tells you to use. There is an interaction between directory structure and config files that can cause problems when you are learning Hugo. You are trying to do intermediate-level Hugo dev, but you are a Hugo beginner.

(*) I just looked at the image of your directory structure and see that you do have config.toml in your home directory. This makes me think that you are new to Linux as well as Hugo - is that true? Before we can help you, we need to know more about what computing experience you have.

1 Like

OMG :scream_cat: I just read the above. How did you create that directory?

Thanks for the answers.

_nm thanks for your advice. But, I’ve already run it before without sudo and got an error…

zaesar@zaesar-X541UV:/home/zaesarpo$ hugo server
Error: failed to create file caches from configuration: operation not permitted
zaesar@zaesar-X541UV:/home/zaesarpo$ sudo hugo server
[sudo] contraseña para zaesar: 

My site where config.toml is already where I’m zaesarpo folder.

How I did home? No fucking idea :sweat_smile:

Really appreciate your time :pray:

If you run hugo config from the root of your project and look for the line that says cachedir what is its value? Am wondering if part of that error is because Hugo cannot read/write to the cache dir.

I get:

cachedir = "/tmp/hugo_cache/"

Okay. What’s the output of this command?

ls -l /tmp/hugo_cache/
zaesar@zaesar-X541UV:/home/zaesarpo$ ls -l /tmp/hugo_cache/
total 8
drwxr-xr-x 3 zaesar zaesar 4096 may 23 15:23 home
drwxr-xr-x 3 root   root   4096 may 23 15:24 zaesarpo

See how root is listed? That explains why you currently have to run hugo server with sudo.

Hmmm…

And how do I fix this? :roll_eyes:

Anyway this doesn’t solve my errors right?

My guess is when you created your site (under zaesarpo), you did so as root.

As for your main error, I think you need to track down what’s going on here:

partials/background.html:23:11: executing “partials/background.html” at <len $bgList>: error
calling len: len of untyped nil

But I need to have this permission for install anything. I can’t do it as a normal user. Need root permisions.

Please run the following three commands as a regular user and post what happens:

whoami
cd ~
pwd

Do not freak out. These are solvable problems and the nature of computing, especially Linux command line if you are new to it.:smiling_face_with_three_hearts:

1 Like