I am using RStudio on Mac. I’ve installed Hugo, Blogdown, and the Hugo-academic theme as well.
I see the following error with the new RStudio (v1.2.616).
Building sites … ERROR 2018/05/08 11:58:13 Failed to render “theme/publication/single.html”: runtime error: invalid memory address or nil pointer dereference
Serving the directory /Users/janani/Google_Drive/Personal/AJ/jananiravi at http://127.0.0.1:4321
To stop the server, run servr::daemon_stop(“140699771731016”) or restart your R session
OK, but just curious why having a working version would gate that… you can also delete a temp repo or force push “working commits” later. I would choose to not force push commits especially in such cases… the commits that making non-working stuff working are very self-educational
You are missing one or more files in there (missing the gallery shortcode, missing the css/parse_theme.css) … running hugo gives me:
Building sites … ERROR 2018/05/08 14:31:50 Unable to locate template for shortcode "gallery" in page "post/getting-started.md"
ERROR 2018/05/08 14:31:50 Error while rendering "home" in "": template: theme/index.css:4:4: executing "theme/index.css" at <partial "css/parse_t...>: error calling partial: Partial "css/parse_theme.css" not found
Did you happen to stitch together site content specific to one theme with an arbitrary different theme?
diff --git a/layouts/partials/publication_links.html b/layouts/partials/publication_links.html
index 1b21ef1..802e9db 100644
--- a/layouts/partials/publication_links.html
+++ b/layouts/partials/publication_links.html
@@ -31,10 +31,12 @@
{{ end }}
{{ if $.Params.projects }}
{{ range $.Params.projects }}
-<a class="btn btn-primary btn-outline{{ if $is_list }} btn-xs{{end}}" href="{{ ($.Site.GetPage "page" "project" .).Permalink }}">
+ {{ with ($.Site.GetPage "page" "project" .) }}
+ <a class="btn btn-primary btn-outline{{ if $is_list }} btn-xs{{end}}" href="{{ .Permalink }}">
{{ i18n "btn_project" }}
</a>
{{ end }}
+ {{ end }}
{{ else }}
{{ with $.Params.url_project }}
<a class="btn btn-primary btn-outline{{ if $is_list }} btn-xs{{end}}" href="{{ . | absLangURL }}" target="_blank" rel="noopener">
The above change fixes it.
The problem was that it was trying to get a page “foo” under the “project/” section where you would have project = "foo" in your front-matter. But even if that page did not exist under project/ section, it would try to get .Permalink out of that… effectively doing nil.Permalink. Now that .Permalink step happens only if the .GetPage succeeds.
Thank you, @kaushalmodi I am making those changes now. I’m new to HTML and would have never figured this out. Really appreciate your timely help. And I have moved the folder out of Google_Drive into my github.io repo. I shall watch the hugo-academic thread from further updates from @gcushen
@bep Is it possible to catch such exceptions and improve the error message so that the user is pointed to the line in the template where that .Permalink call is happening on nil? If so, should I open an issue?
Hmm … I think I have investigated this before, but I may give it another shot. The stack trace (that we don’t show) is not useful, as it just points to some point in Go’s framework (and not the line in the template). But I have seen some talk about “template nils” suggesting that we could maybe possibly do better. We should at least talk to the Go people about it and see if there are something we can do. I got pretty good training tracking down these situations, but I can imagine the pain of people new to Hugo.
Create an issue, but I will not promise anything …
I’ve got the same error. I’ve had a break from coding in almost a month, and when I got back, I got the nil pointer error when running hugo serve. I haven’t made any changes. For me it looks like something new introduced in version 0.40.3 or newer (My last commit was on May 8th).
I’ve just tested that 0.40.2 works.
0.40.3 burps out the error, but then it serves the site (with errors - missing footers on some pages).