GDGToulouse / devfest-theme-hugo

A theme for a conference website. Created for DevFest Toulouse 2019
MIT License
88 stars 67 forks source link

Error building site: failed to render pages #23

Open jtatum opened 3 years ago

jtatum commented 3 years ago

I'm following the "getting started" steps with hugo extended v0.83.1. I created a new site, added the submodule, and changed the theme in config.toml, and ran hugo serve. I'm getting the following error:

ERROR 2021/06/23 00:15:58 render of "home" failed: "/Users/jtatum/projects/website/themes/devfest-theme-hugo/layouts/_default/baseof.html:7:3": execute of template failed: template: index.html:7:3: executing "index.html" at <readFile "static/icons.svg">: error calling readFile: stat /Users/jtatum/projects/website/static/icons.svg: no such file or directory
ERROR 2021/06/23 00:15:58 render of "taxonomy" failed: "/Users/jtatum/projects/website/themes/devfest-theme-hugo/layouts/_default/baseof.html:7:3": execute of template failed: template: taxonomy/list.html:7:3: executing "taxonomy/list.html" at <readFile "static/icons.svg">: error calling readFile: stat /Users/jtatum/projects/website/static/icons.svg: no such file or directory

I fixed this by running cp themes/devfest-theme-hugo/static/* static/. Not sure if this is a misconfiguration on my part or something that needs to be in the instructions? Thanks for a cool theme.

ilaborie commented 3 years ago

Sorry, the readme is not up to date.

You need to go to the theme folder, install dependencies, and build static files:

cd themes/devfest-theme-hugo
npm install
npm run build

Note that requires the Node toolchains

luzfcb commented 3 years ago

I ran the commands but still get the same error. The full steps that I made:

mkdir projects
cd projects/

# setup nodejs 14.x via python and temporary add to PATH (via source command)
python3 -m pip install nodeenv
nodeenv -n 14.17.1 node14
source node14/bin/activate

# setup hugo 0.84
wget https://github.com/gohugoio/hugo/releases/download/v0.84.1/hugo_extended_0.84.1_Linux-64bit.tar.gz
tar -xvzf hugo_extended_0.84.1_Linux-64bit.tar.gz
chmod +x hugo
rm hugo_extended_0.84.1_Linux-64bit.tar.gz LICENSE README.md

# starting project
./hugo new site mysite
cd mysite
git init
git add -A
git commit -m "first commit"

echo 'theme = "devfest-theme-hugo"' > config.toml

mkdir -p themes
git submodule add https://github.com/GDGToulouse/devfest-theme-hugo.git themes/devfest-theme-hugo

cd themes/devfest-theme-hugo
npm install
npm run build
cd ../../

../hugo serve -D

When I finally run ../hugo serve -D, the errors below are shown.

start building sites … 
hugo v0.84.1-4BD65E22+extended linux/amd64 BuildDate=2021-06-24T11:44:23Z VendorInfo=gohugoio
Page.URL is deprecated and will be removed in a future release. Use .Permalink or .RelPermalink. If what you want is the front matter URL value, use .Params.url
ERROR 2021/06/26 23:13:00 render of "taxonomy" failed: "/tmp/projects/mysite/themes/devfest-theme-hugo/layouts/_default/baseof.html:7:3": execute of template failed: template: taxonomy/list.html:7:3: executing "taxonomy/list.html" at <readFile "static/icons.svg">: error calling readFile: stat /tmp/projects/mysite/static/icons.svg: no such file or directory
ERROR 2021/06/26 23:13:00 render of "taxonomy" failed: "/tmp/projects/mysite/themes/devfest-theme-hugo/layouts/_default/baseof.html:7:3": execute of template failed: template: taxonomy/list.html:7:3: executing "taxonomy/list.html" at <readFile "static/icons.svg">: error calling readFile: stat /tmp/projects/mysite/static/icons.svg: no such file or directory
Built in 9 ms
Error: Error building site: failed to render pages: render of "home" failed: "/tmp/projects/mysite/themes/devfest-theme-hugo/layouts/_default/baseof.html:7:3": execute of template failed: template: index.html:7:3: executing "index.html" at <readFile "static/icons.svg">: error calling readFile: stat /tmp/projects/mysite/static/icons.svg: no such file or directory
tomas-mazak commented 3 years ago

Same here ... for some reason, the theme is looking for those static files in site's static directory, while they are available in themes/devfest-theme-hugo/static directory. Copying them over seems to resolve the problem, but not sure that's how it is supposed to be used

jeffman78 commented 2 years ago

Same issue, rebuilding the SCSS with yarn/npm didn't help. However as suggested, a cp ./themes/devfest-theme-hugo/static/icons.svg ./static/ fixed the problem.