Error with Preview Site

Hi - I am trying to set up my first hugo site through and am following a guide. One of the initial steps is to run the following code:

new_site(theme = “wowchemy/starter-academic”)

Which then asks me to preview the site. Once I center submit, I get the following error

Want to serve and preview the site now? (y/n) y
Launching the server via the command:
C:/Users/dvo/AppData/Roaming/Hugo/0.91.0/hugo.exe server --bind 127.0.0.1 -p 4321 --themesDir themes -t starter-hugo-academic -D -F --navigateToChanged
Error: Error building site: failed to render pages: render of “page” failed: execute of template failed: template: book/single.html:5:3: executing “book/single.html” at <partial “site_head” .>: error calling partial: “D:\Documents\R\Website\dvo\themes\github.com\wowchemy\wowchemy-hugo-modules\wowchemy\v5\layouts\partials\site_head.html:208:13”: execute of template failed: template: partials/site_head.html:208:13: executing “partials/site_head.html” at <getenv “WC_POST_CSS”>: error calling getenv: access denied: “WC_POST_CSS” is not whitelisted in policy “security.funcs.getenv”; the current security configuration is:

[security]
enableInlineShortcodes = false
[security.exec]
allow = [’^dart-sass-embedded$’, ‘^go$’, ‘^npx$’, ‘^postcss$’]
osEnv = [’(?i)^(PATH|PATHEXT|APPDATA|TMP|TEMP|TERM)$’]

[security.funcs]
getenv = [’^HUGO_’]

[security.http]
methods = [’(?i)GET|POST’]
urls = [’.*’]

I am unable to see my sit through my Viewer. Any ideas on how to fix this?

I’m having the same issue when I run sudo hugo on macOS 12.0.1. My first error is:

ERROR 2021/12/20 17:08:06 render of “page” failed: execute of template failed: template: _default/single.html:5:3: executing “_default/single.html” at <partial “site_head” .>: error calling partial: “/tmp/hugo_cache/modules/filecache/modules/pkg/mod/github.com/wowchemy/wowchemy-hugo-modules/wowchemy/v5@v5.0.0-20211122231030-d26f01d5d6c3/layouts/partials/site_head.html:208:13”: execute of template failed: template: partials/site_head.html:208:13: executing “partials/site_head.html” at <getenv “WC_POST_CSS”>: error calling getenv: access denied: “WC_POST_CSS” is not whitelisted in policy “security.funcs.getenv”; the current security configuration is:

[security]
enableInlineShortcodes = false
[security.exec]
allow = [’^dart-sass-embedded$’, ‘^go$’, ‘^npx$’, ‘^postcss$’]
osEnv = [’(?i)^(PATH|PATHEXT|APPDATA|TMP|TEMP|TERM)$’]

[security.funcs]
getenv = [’^HUGO_’]

[security.http]
methods = [’(?i)GET|POST’]
urls = [’.*’]

The error message is telling you what’s wrong:

“WC_POST_CSS” is not whitelisted in policy “security.funcs.getenv”

The error message is showing you the current value of “security.funcs.getenv"

[security.funcs]
getenv = [’^HUGO_’]

So all you need to do is add “WC_POST_CSS” to “security.funcs.getenv” in your site configuration.

[security.funcs]
getenv = ['^HUGO_', '^WC_POST_CSS' ]

Please see:

This won’t help your issue, but you shouldn’t by running hugo as Super User. If you hugo doesn’t work without sudo then something’s gone wrong with the way you’ve installed it.

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