Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid memory address or nil pointer dereference on Windows #3

Closed
AnimMouse opened this issue Jan 10, 2023 · 24 comments
Closed

Invalid memory address or nil pointer dereference on Windows #3

AnimMouse opened this issue Jan 10, 2023 · 24 comments

Comments

@AnimMouse
Copy link

When trying to build exampleSite on Windows, it errors, but in Ubuntu, it is working.

cd exampleSite
hugo --themesDir ../..

Start building sites …
hugo v0.109.0-47b12b83e636224e5e601813ff3e6790c191e371 windows/amd64 BuildDate=2022-12-23T10:38:11Z VendorInfo=gohugoio
ERROR 2023/01/10 12:54:41 render of "page" failed: "D:\a\github-actions-testing\github-actions-testing\paige\layouts\_default\baseof.html:5:7": execute of template failed: template: _default/single.html:5:7: executing "_default/single.html" at <partial "paige/head.html" .>: error calling partial: "D:\a\github-actions-testing\github-actions-testing\paige\layouts\partials\paige\head.html:4:7": execute of template failed: template: partials/paige/head.html:4:7: executing "partials/paige/head.html" at <partial "paige/links.html" .>: error calling partial: execute of template failed: template: partials/paige/links.html:16:3: executing "partials/paige/links.html" at <partial "paige/link.html" (dict "href" (.Site.Params.paige.bootstrap.style.link_href | default "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css") "integrity" .Site.Params.paige.bootstrap.style.link_integrity "remote" .Site.Params.paige.bootstrap.style.remote)>: error calling partial: execute of template failed: template: partials/paige/link.html:11:21: executing "partials/paige/link.html" at <partial "paige/func-resource.html" (dict "page" $page "url" $href)>: error calling partial: "D:\a\github-actions-testing\github-actions-testing\paige\layouts\partials\paige\func-resource.html:11:25": execute of template failed: template: partials/paige/func-resource.html:11:25: executing "partials/paige/func-resource.html" at <resources.GetMatch>: error calling GetMatch: runtime error: invalid memory address or nil pointer dereference
ERROR 2023/01/10 12:54:41 render of "page" failed: "D:\a\github-actions-testing\github-actions-testing\paige\layouts\_default\baseof.html:5:7": execute of template failed: template: _default/single.html:5:7: executing "_default/single.html" at <partial "paige/head.html" .>: error calling partial: "D:\a\github-actions-testing\github-actions-testing\paige\layouts\partials\paige\head.html:4:7": execute of template failed: template: partials/paige/head.html:4:7: executing "partials/paige/head.html" at <partial "paige/links.html" .>: error calling partial: execute of template failed: template: partials/paige/links.html:16:3: executing "partials/paige/links.html" at <partial "paige/link.html" (dict "href" (.Site.Params.paige.bootstrap.style.link_href | default "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css") "integrity" .Site.Params.paige.bootstrap.style.link_integrity "remote" .Site.Params.paige.bootstrap.style.remote)>: error calling partial: execute of template failed: template: partials/paige/link.html:11:21: executing "partials/paige/link.html" at <partial "paige/func-resource.html" (dict "page" $page "url" $href)>: error calling partial: "D:\a\github-actions-testing\github-actions-testing\paige\layouts\partials\paige\func-resource.html:11:25": execute of template failed: template: partials/paige/func-resource.html:11:25: executing "partials/paige/func-resource.html" at <resources.GetMatch>: error calling GetMatch: runtime error: invalid memory address or nil pointer dereference
ERROR 2023/01/10 12:54:41 render of "page" failed: "D:\a\github-actions-testing\github-actions-testing\paige\layouts\_default\baseof.html:5:7": execute of template failed: template: _default/paige/search.html:5:7: executing "_default/paige/search.html" at <partial "paige/head.html" .>: error calling partial: "D:\a\github-actions-testing\github-actions-testing\paige\layouts\partials\paige\head.html:4:7": execute of template failed: template: partials/paige/head.html:4:7: executing "partials/paige/head.html" at <partial "paige/links.html" .>: error calling partial: execute of template failed: template: partials/paige/links.html:16:3: executing "partials/paige/links.html" at <partial "paige/link.html" (dict "href" (.Site.Params.paige.bootstrap.style.link_href | default "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css") "integrity" .Site.Params.paige.bootstrap.style.link_integrity "remote" .Site.Params.paige.bootstrap.style.remote)>: error calling partial: execute of template failed: template: partials/paige/link.html:11:21: executing "partials/paige/link.html" at <partial "paige/func-resource.html" (dict "page" $page "url" $href)>: error calling partial: "D:\a\github-actions-testing\github-actions-testing\paige\layouts\partials\paige\func-resource.html:11:25": execute of template failed: template: partials/paige/func-resource.html:11:25: executing "partials/paige/func-resource.html" at <resources.GetMatch>: error calling GetMatch: runtime error: invalid memory address or nil pointer dereference
ERROR 2023/01/10 12:54:41 render of "page" failed: "D:\a\github-actions-testing\github-actions-testing\paige\layouts\_default\baseof.html:5:7": execute of template failed: template: _default/single.html:5:7: executing "_default/single.html" at <partial "paige/head.html" .>: error calling partial: "D:\a\github-actions-testing\github-actions-testing\paige\layouts\partials\paige\head.html:4:7": execute of template failed: template: partials/paige/head.html:4:7: executing "partials/paige/head.html" at <partial "paige/links.html" .>: error calling partial: execute of template failed: template: partials/paige/links.html:16:3: executing "partials/paige/links.html" at <partial "paige/link.html" (dict "href" (.Site.Params.paige.bootstrap.style.link_href | default "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css") "integrity" .Site.Params.paige.bootstrap.style.link_integrity "remote" .Site.Params.paige.bootstrap.style.remote)>: error calling partial: execute of template failed: template: partials/paige/link.html:11:21: executing "partials/paige/link.html" at <partial "paige/func-resource.html" (dict "page" $page "url" $href)>: error calling partial: "D:\a\github-actions-testing\github-actions-testing\paige\layouts\partials\paige\func-resource.html:11:25": execute of template failed: template: partials/paige/func-resource.html:11:25: executing "partials/paige/func-resource.html" at <resources.GetMatch>: error calling GetMatch: runtime error: invalid memory address or nil pointer dereference
Error: Error building site: failed to render pages: render of "page" failed: "D:\a\github-actions-testing\github-actions-testing\paige\layouts\_default\baseof.html:5:7": execute of template failed: template: _default/single.html:5:7: executing "_default/single.html" at <partial "paige/head.html" .>: error calling partial: "D:\a\github-actions-testing\github-actions-testing\paige\layouts\partials\paige\head.html:4:7": execute of template failed: template: partials/paige/head.html:4:7: executing "partials/paige/head.html" at <partial "paige/links.html" .>: error calling partial: execute of template failed: template: partials/paige/links.html:16:3: executing "partials/paige/links.html" at <partial "paige/link.html" (dict "href" (.Site.Params.paige.bootstrap.style.link_href | default "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css") "integrity" .Site.Params.paige.bootstrap.style.link_integrity "remote" .Site.Params.paige.bootstrap.style.remote)>: error calling partial: execute of template failed: template: partials/paige/link.html:11:21: executing "partials/paige/link.html" at <partial "paige/func-resource.html" (dict "page" $page "url" $href)>: error calling partial: "D:\a\github-actions-testing\github-actions-testing\paige\layouts\partials\paige\func-resource.html:11:25": execute of template failed: template: partials/paige/func-resource.html:11:25: executing "partials/paige/func-resource.html" at <resources.GetMatch>: error calling GetMatch: runtime error: invalid memory address or nil pointer dereference
Total in 246 ms
@luisimasd
Copy link

same here, moved to ubuntu on WSL it doesn't work either

@willfaught
Copy link
Owner

@AnimMouse Sorry for the delay responding. Somehow I was unsubscribed from issue notifications.

Does the problem still occur on the latest version?

The problem seems to be here:

executing "partials/paige/links.html" at <partial "paige/link.html" (dict "href" (.Site.Params.paige.bootstrap.style.link_href | default "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css") "integrity" .Site.Params.paige.bootstrap.style.link_integrity "remote" .Site.Params.paige.bootstrap.style.remote)>

It looks like resources.GetMatch had a problem with the input of .Site.Params.paige.bootstrap.style.link_href | default "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css".

What was your config value for .Site.Params.paige.bootstrap.style.link_href?

@Dekker500
Copy link

I am seeing the same problem.

The problem is showing on a raw, clean base new site created with your template, with no modifications.

PS C:\hugo\paige\exampleSite> hugo version
hugo v0.110.0-e32a493b7826d02763c3b79623952e625402b168 windows/amd64 BuildDate=2023-01-17T12:16:09Z VendorInfo=gohugoio
PS C:\hugo> git clone https://github.com/willfaught/paige paige
Cloning into 'paige'...
remote: Enumerating objects: 4474, done.
remote: Counting objects: 100% (1785/1785), done.
remote: Compressing objects: 100% (370/370), done.
Receiving objects: 100% (4474/4474), 8.92 MiB | 2.95 MiB/s, done.
remote: Total 4474 (delta 1384), reused 1685 (delta 1317), pack-reused 2689
Resolving deltas: 100% (2830/2830), done.
PS C:\hugo> cd paige
PS C:\hugo\paige> cd .\exampleSite\
PS C:\hugo\paige\exampleSite> hugo --themesDir ../..
Start building sites …
hugo v0.110.0-e32a493b7826d02763c3b79623952e625402b168 windows/amd64 BuildDate=2023-01-17T12:16:09Z VendorInfo=gohugoio
ERROR 2023/02/10 07:03:40 render of "page" failed: "C:\hugo\paige\layouts\_default\baseof.html:10:7": execute of template failed: template: _default/paige/search.html:10:7: executing "_default/paige/search.html" at <partial "paige/head.html" $page>: error calling partial: "C:\hugo\paige\layouts\partials\paige\head.html:12:7": execute of template failed: template: partials/paige/head.html:12:7: executing "partials/paige/head.html" at <partial "paige/links.html" $page>: error calling partial: execute of template failed: template: partials/paige/links.html:21:3: executing "partials/paige/links.html" at <partial "paige/link.html" (dict "href" ($page.Param "paige.bootstrap.style.link_href" | default "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css") "integrity" ($page.Param "paige.bootstrap.style.link_integrity") "raw" ($page.Param "paige.bootstrap.style.raw"))>: error calling partial: execute of template failed: template: partials/paige/link.html:13:21: executing "partials/paige/link.html" at <partial "paige/func-resource.html" (dict "page" $page "url" (relLangURL $href))>: error calling partial: "C:\hugo\paige\layouts\partials\paige\func-resource.html:14:25": execute of template failed: template: partials/paige/func-resource.html:14:25: executing "partials/paige/func-resource.html" at <resources.GetMatch>: error calling GetMatch: runtime error: invalid memory address or nil pointer dereference
ERROR 2023/02/10 07:03:40 render of "page" failed: "C:\hugo\paige\layouts\_default\baseof.html:10:7": execute of template failed: template: _default/single.html:10:7: executing "_default/single.html" at <partial "paige/head.html" $page>: error calling partial: "C:\hugo\paige\layouts\partials\paige\head.html:12:7": execute of template failed: template: partials/paige/head.html:12:7: executing "partials/paige/head.html" at <partial "paige/links.html" $page>: error calling partial: execute of template failed: template: partials/paige/links.html:21:3: executing "partials/paige/links.html" at <partial "paige/link.html" (dict "href" ($page.Param "paige.bootstrap.style.link_href" | default "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css") "integrity" ($page.Param "paige.bootstrap.style.link_integrity") "raw" ($page.Param "paige.bootstrap.style.raw"))>: error calling partial: execute of template failed: template: partials/paige/link.html:13:21: executing "partials/paige/link.html" at <partial "paige/func-resource.html" (dict "page" $page "url" (relLangURL $href))>: error calling partial: "C:\hugo\paige\layouts\partials\paige\func-resource.html:14:25": execute of template failed: template: partials/paige/func-resource.html:14:25: executing "partials/paige/func-resource.html" at <resources.GetMatch>: error calling GetMatch: runtime error: invalid memory address or nil pointer dereference
ERROR 2023/02/10 07:03:40 render of "page" failed: "C:\hugo\paige\layouts\_default\baseof.html:10:7": execute of template failed: template: _default/single.html:10:7: executing "_default/single.html" at <partial "paige/head.html" $page>: error calling partial: "C:\hugo\paige\layouts\partials\paige\head.html:12:7": execute of template failed: template: partials/paige/head.html:12:7: executing "partials/paige/head.html" at <partial "paige/links.html" $page>: error calling partial: execute of template failed: template: partials/paige/links.html:21:3: executing "partials/paige/links.html" at <partial "paige/link.html" (dict "href" ($page.Param "paige.bootstrap.style.link_href" | default "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css") "integrity" ($page.Param "paige.bootstrap.style.link_integrity") "raw" ($page.Param "paige.bootstrap.style.raw"))>: error calling partial: execute of template failed: template: partials/paige/link.html:13:21: executing "partials/paige/link.html" at <partial "paige/func-resource.html" (dict "page" $page "url" (relLangURL $href))>: error calling partial: "C:\hugo\paige\layouts\partials\paige\func-resource.html:14:25": execute of template failed: template: partials/paige/func-resource.html:14:25: executing "partials/paige/func-resource.html" at <resources.GetMatch>: error calling GetMatch: runtime error: invalid memory address or nil pointer dereference
ERROR 2023/02/10 07:03:40 render of "page" failed: "C:\hugo\paige\layouts\_default\baseof.html:10:7": execute of template failed: template: _default/single.html:10:7: executing "_default/single.html" at <partial "paige/head.html" $page>: error calling partial: "C:\hugo\paige\layouts\partials\paige\head.html:12:7": execute of template failed: template: partials/paige/head.html:12:7: executing "partials/paige/head.html" at <partial "paige/links.html" $page>: error calling partial: execute of template failed: template: partials/paige/links.html:21:3: executing "partials/paige/links.html" at <partial "paige/link.html" (dict "href" ($page.Param "paige.bootstrap.style.link_href" | default "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css") "integrity" ($page.Param "paige.bootstrap.style.link_integrity") "raw" ($page.Param "paige.bootstrap.style.raw"))>: error calling partial: execute of template failed: template: partials/paige/link.html:13:21: executing "partials/paige/link.html" at <partial "paige/func-resource.html" (dict "page" $page "url" (relLangURL $href))>: error calling partial: "C:\hugo\paige\layouts\partials\paige\func-resource.html:14:25": execute of template failed: template: partials/paige/func-resource.html:14:25: executing "partials/paige/func-resource.html" at <resources.GetMatch>: error calling GetMatch: runtime error: invalid memory address or nil pointer dereference
Error: Error building site: failed to render pages: render of "page" failed: "C:\hugo\paige\layouts\_default\baseof.html:10:7": execute of template failed: template: _default/single.html:10:7: executing "_default/single.html" at <partial "paige/head.html" $page>: error calling partial: "C:\hugo\paige\layouts\partials\paige\head.html:12:7": execute of template failed: template: partials/paige/head.html:12:7: executing "partials/paige/head.html" at <partial "paige/links.html" $page>: error calling partial: execute of template failed: template: partials/paige/links.html:21:3: executing "partials/paige/links.html" at <partial "paige/link.html" (dict "href" ($page.Param "paige.bootstrap.style.link_href" | default "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css") "integrity" ($page.Param "paige.bootstrap.style.link_integrity") "raw" ($page.Param "paige.bootstrap.style.raw"))>: error calling partial: execute of template failed: template: partials/paige/link.html:13:21: executing "partials/paige/link.html" at <partial "paige/func-resource.html" (dict "page" $page "url" (relLangURL $href))>: error calling partial: "C:\hugo\paige\layouts\partials\paige\func-resource.html:14:25": execute of template failed: template: partials/paige/func-resource.html:14:25: executing "partials/paige/func-resource.html" at <resources.GetMatch>: error calling GetMatch: runtime error: invalid memory address or nil pointer dereference
Total in 1409 ms

@Dekker500
Copy link

Oh, and to answer your direct question, the only reference I could find to .Site.Params.paige.bootstrap.style.link_href was in layouts\partials\paige\links.html', line 22.

    "href" ($page.Param "paige.bootstrap.style.link_href" | default "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css")
    "integrity" ($page.Param "paige.bootstrap.style.link_integrity")
    "raw" ($page.Param "paige.bootstrap.style.raw")
) }}```

@willfaught
Copy link
Owner

@Dekker500 Thanks for the info. Unfortunately, I don't have a Windows computer with WSL set up, so I can't repro the issue directly. If I can know what the input to resources.GetMatch is, I might be able to figure out the issue anyway.

I asked for the value of .Site.Params.paige.bootstrap.style.link_href because it determines the input. If it's unset, then the default of "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" is used. .Site.Params.paige.bootstrap.style.link_href is set in the site config.

Also, I can tell from .Site.Params.paige.bootstrap.style.link_href that you're not using the latest version. What happens if you use the latest version? It would be easier to debug with a more recent stack trace.

@willfaught
Copy link
Owner

@luisimasd @AnimMouse Can either of you report the site/page config you used? See my post above. I can't debug without knowing this.

@Dekker500
Copy link

I won't be able to test until the 20th, however the site config was the one you provided. The course shown above is the exact sequence I followed in a brand new folder.

Will report after the 20th... Sorry!

@AnimMouse
Copy link
Author

Can either of you report the site/page config you used?

We haven't edited any configuration, I basically run Hugo on your exampleSite folder on Windows.

Unfortunately, I don't have a Windows computer with WSL set up, so I can't repro the issue directly.

Since I saw you use GitHub Actions for CI/CD, you can use GitHub Actions' Windows runners by using runs-on: windows-latest on your current workflow.
If you have a Windows computer, you don't need WSL, you can run it on command prompt.

The logs below are created on GitHub Actions Windows runners for clean reproducible environment.

Logs as of be57840:

git clone https://github.com/willfaught/paige.git
cd paige/exampleSite
hugo --themesDir ../..

Start building sites …
hugo v0.110.0-e32a493b7826d02763c3b79623952e625402b168 windows/amd64 BuildDate=2023-01-17T12:16:09Z VendorInfo=gohugoio
Error: Error building site: "D:\a\github-actions-testing\github-actions-testing\paige\exampleSite\content\shortcodes\gallery\index.md:27:1": failed to render shortcode "paige/gallery": failed to process shortcode: execute of template failed: template: shortcodes/paige/gallery.html:49:23: executing "shortcodes/paige/gallery.html" at <partial "paige/img.html" (dict "class" "img-fluid" "height" $height "maxheight" $maxheight "maxwidth" $maxwidth "method" $method "options" $options "resource" $resource "src" $image "width" $width)>: error calling partial: execute of template failed: template: partials/paige/img.html:30:23: executing "partials/paige/img.html" at <partial "paige/func-resource.html" (dict "page" $page "url" $src)>: error calling partial: "D:\a\github-actions-testing\github-actions-testing\paige\layouts\partials\paige\func-resource.html:14:25": execute of template failed: template: partials/paige/func-resource.html:14:25: executing "partials/paige/func-resource.html" at <resources.GetMatch>: error calling GetMatch: runtime error: invalid memory address or nil pointer dereference
Total in 750 ms

Hugo extended:

git clone https://github.com/willfaught/paige.git
cd paige/exampleSite
hugo --themesDir ../..

Start building sites …
hugo v0.110.0-e32a493b7826d02763c3b79623952e625402b168+extended windows/amd64 BuildDate=2023-01-17T12:16:09Z VendorInfo=gohugoio
Error: Error building site: "D:\a\github-actions-testing\github-actions-testing\paige\exampleSite\content\shortcodes\gallery\index.md:27:1": failed to render shortcode "paige/gallery": failed to process shortcode: execute of template failed: template: shortcodes/paige/gallery.html:49:23: executing "shortcodes/paige/gallery.html" at <partial "paige/img.html" (dict "class" "img-fluid" "height" $height "maxheight" $maxheight "maxwidth" $maxwidth "method" $method "options" $options "resource" $resource "src" $image "width" $width)>: error calling partial: execute of template failed: template: partials/paige/img.html:30:23: executing "partials/paige/img.html" at <partial "paige/func-resource.html" (dict "page" $page "url" $src)>: error calling partial: "D:\a\github-actions-testing\github-actions-testing\paige\layouts\partials\paige\func-resource.html:14:25": execute of template failed: template: partials/paige/func-resource.html:14:25: executing "partials/paige/func-resource.html" at <resources.GetMatch>: error calling GetMatch: runtime error: invalid memory address or nil pointer dereference
Total in 822 ms

@rogerssam
Copy link

rogerssam commented Feb 19, 2023

I've experienced this same error but haven't had time to work out how to get a log file or more detailed debug information about it. As above, I've experienced it on a new/clean site, using the exampleSite config.

I think it comes from this line, but that's as far as I've got;

{{ with resources.GetMatch $url }}

Happy to help in any way I can.

@willfaught
Copy link
Owner

@rogerssam Were you using Windows too?

@rogerssam
Copy link

@rogerssam Were you using Windows too?

Yes I am. Win10 pro. Happy to run anything to help debug :)

@willfaught
Copy link
Owner

After some debugging, I might have a fix. The error still happens on a GitHub runner running Windows Server, but it doesn't happen on a PC running Windows 11. Would someone please test v0.39.0 and report back?

@rogerssam
Copy link

After some debugging, I might have a fix. The error still happens on a GitHub runner running Windows Server, but it doesn't happen on a PC running Windows 11. Would someone please test v0.39.0 and report back?

I can confirm this works for me with a blank site using the default exampleSite config and content. Thanks!

@willfaught
Copy link
Owner

Thanks, @rogerssam!

@AnimMouse @luisimasd @Dekker500 Does it work for you?

@AnimMouse
Copy link
Author

Tried running on Windows 11 and Windows 10, still errors, but different message.

Windows 11 logs as of 0f6f3ba:

git clone https://github.com/willfaught/paige.git
cd paige/exampleSite
hugo --themesDir ../..

WARN 2023/02/26 16:37:20 Module "paige" is not compatible with this Hugo version; run "hugo mod graph" for more information.
Start building sites …
hugo v0.110.0-e32a493b7826d02763c3b79623952e625402b168 windows/amd64 BuildDate=2023-01-17T12:16:09Z VendorInfo=gohugoio
ERROR 2023/02/26 16:37:20 invalid resource: "paige/bootstrap-icons/bootstrap-icons.css"
ERROR 2023/02/26 16:37:21 render of "page" failed: "C:\Users\AnimMouse\Desktop\paige\layouts\_default\baseof.html:5:7": execute of template failed: template: _default/single.html:5:7: executing "_default/single.html" at <partial "paige/head.html" $page>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\head.html:12:7": execute of template failed: template: partials/paige/head.html:12:7: executing "partials/paige/head.html" at <partial "paige/links.html" $page>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\links.html:16:3": execute of template failed: template: partials/paige/links.html:16:3: executing "partials/paige/links.html" at <partial "paige/link.html" (dict "href" "paige/bootstrap-icons/bootstrap-icons.css")>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\link.html:20:28": execute of template failed: template: partials/paige/link.html:20:28: executing "partials/paige/link.html" at <resources.ExecuteAsTemplate>: error calling ExecuteAsTemplate: type string not supported in Resource transformations
ERROR 2023/02/26 16:37:21 render of "page" failed: "C:\Users\AnimMouse\Desktop\paige\layouts\_default\baseof.html:5:7": execute of template failed: template: _default/single.html:5:7: executing "_default/single.html" at <partial "paige/head.html" $page>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\head.html:12:7": execute of template failed: template: partials/paige/head.html:12:7: executing "partials/paige/head.html" at <partial "paige/links.html" $page>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\links.html:16:3": execute of template failed: template: partials/paige/links.html:16:3: executing "partials/paige/links.html" at <partial "paige/link.html" (dict "href" "paige/bootstrap-icons/bootstrap-icons.css")>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\link.html:20:28": execute of template failed: template: partials/paige/link.html:20:28: executing "partials/paige/link.html" at <resources.ExecuteAsTemplate>: error calling ExecuteAsTemplate: type string not supported in Resource transformations
ERROR 2023/02/26 16:37:21 render of "page" failed: "C:\Users\AnimMouse\Desktop\paige\layouts\_default\baseof.html:5:7": execute of template failed: template: _default/single.html:5:7: executing "_default/single.html" at <partial "paige/head.html" $page>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\head.html:12:7": execute of template failed: template: partials/paige/head.html:12:7: executing "partials/paige/head.html" at <partial "paige/links.html" $page>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\links.html:16:3": execute of template failed: template: partials/paige/links.html:16:3: executing "partials/paige/links.html" at <partial "paige/link.html" (dict "href" "paige/bootstrap-icons/bootstrap-icons.css")>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\link.html:20:28": execute of template failed: template: partials/paige/link.html:20:28: executing "partials/paige/link.html" at <resources.ExecuteAsTemplate>: error calling ExecuteAsTemplate: type string not supported in Resource transformations
ERROR 2023/02/26 16:37:21 render of "page" failed: "C:\Users\AnimMouse\Desktop\paige\layouts\_default\baseof.html:5:7": execute of template failed: template: _default/single.html:5:7: executing "_default/single.html" at <partial "paige/head.html" $page>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\head.html:12:7": execute of template failed: template: partials/paige/head.html:12:7: executing "partials/paige/head.html" at <partial "paige/links.html" $page>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\links.html:16:3": execute of template failed: template: partials/paige/links.html:16:3: executing "partials/paige/links.html" at <partial "paige/link.html" (dict "href" "paige/bootstrap-icons/bootstrap-icons.css")>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\link.html:20:28": execute of template failed: template: partials/paige/link.html:20:28: executing "partials/paige/link.html" at <resources.ExecuteAsTemplate>: error calling ExecuteAsTemplate: type string not supported in Resource transformations
Error: Error building site: failed to render pages: render of "page" failed: "C:\Users\AnimMouse\Desktop\paige\layouts\_default\baseof.html:5:7": execute of template failed: template: _default/paige/search.html:5:7: executing "_default/paige/search.html" at <partial "paige/head.html" $page>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\head.html:12:7": execute of template failed: template: partials/paige/head.html:12:7: executing "partials/paige/head.html" at <partial "paige/links.html" $page>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\links.html:16:3": execute of template failed: template: partials/paige/links.html:16:3: executing "partials/paige/links.html" at <partial "paige/link.html" (dict "href" "paige/bootstrap-icons/bootstrap-icons.css")>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\link.html:20:28": execute of template failed: template: partials/paige/link.html:20:28: executing "partials/paige/link.html" at <resources.ExecuteAsTemplate>: error calling ExecuteAsTemplate: type string not supported in Resource transformations
Total in 232 ms

Hugo extended:

git clone https://github.com/willfaught/paige.git
cd paige/exampleSite
hugo --themesDir ../..

Start building sites …
hugo v0.110.0-e32a493b7826d02763c3b79623952e625402b168+extended windows/amd64 BuildDate=2023-01-17T12:16:09Z VendorInfo=gohugoio
ERROR 2023/02/26 17:40:23 invalid resource: "paige/bootstrap-icons/bootstrap-icons.css"
ERROR 2023/02/26 17:40:24 render of "page" failed: "C:\Users\AnimMouse\Desktop\paige\layouts\_default\baseof.html:5:7": execute of template failed: template: _default/single.html:5:7: executing "_default/single.html" at <partial "paige/head.html" $page>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\head.html:12:7": execute of template failed: template: partials/paige/head.html:12:7: executing "partials/paige/head.html" at <partial "paige/links.html" $page>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\links.html:16:3": execute of template failed: template: partials/paige/links.html:16:3: executing "partials/paige/links.html" at <partial "paige/link.html" (dict "href" "paige/bootstrap-icons/bootstrap-icons.css")>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\link.html:20:28": execute of template failed: template: partials/paige/link.html:20:28: executing "partials/paige/link.html" at <resources.ExecuteAsTemplate>: error calling ExecuteAsTemplate: type string not supported in Resource transformations
ERROR 2023/02/26 17:40:24 render of "page" failed: "C:\Users\AnimMouse\Desktop\paige\layouts\_default\baseof.html:5:7": execute of template failed: template: _default/single.html:5:7: executing "_default/single.html" at <partial "paige/head.html" $page>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\head.html:12:7": execute of template failed: template: partials/paige/head.html:12:7: executing "partials/paige/head.html" at <partial "paige/links.html" $page>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\links.html:16:3": execute of template failed: template: partials/paige/links.html:16:3: executing "partials/paige/links.html" at <partial "paige/link.html" (dict "href" "paige/bootstrap-icons/bootstrap-icons.css")>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\link.html:20:28": execute of template failed: template: partials/paige/link.html:20:28: executing "partials/paige/link.html" at <resources.ExecuteAsTemplate>: error calling ExecuteAsTemplate: type string not supported in Resource transformations
ERROR 2023/02/26 17:40:24 render of "page" failed: "C:\Users\AnimMouse\Desktop\paige\layouts\_default\baseof.html:5:7": execute of template failed: template: _default/single.html:5:7: executing "_default/single.html" at <partial "paige/head.html" $page>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\head.html:12:7": execute of template failed: template: partials/paige/head.html:12:7: executing "partials/paige/head.html" at <partial "paige/links.html" $page>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\links.html:16:3": execute of template failed: template: partials/paige/links.html:16:3: executing "partials/paige/links.html" at <partial "paige/link.html" (dict "href" "paige/bootstrap-icons/bootstrap-icons.css")>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\link.html:20:28": execute of template failed: template: partials/paige/link.html:20:28: executing "partials/paige/link.html" at <resources.ExecuteAsTemplate>: error calling ExecuteAsTemplate: type string not supported in Resource transformations
ERROR 2023/02/26 17:40:24 render of "page" failed: "C:\Users\AnimMouse\Desktop\paige\layouts\_default\baseof.html:5:7": execute of template failed: template: _default/single.html:5:7: executing "_default/single.html" at <partial "paige/head.html" $page>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\head.html:12:7": execute of template failed: template: partials/paige/head.html:12:7: executing "partials/paige/head.html" at <partial "paige/links.html" $page>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\links.html:16:3": execute of template failed: template: partials/paige/links.html:16:3: executing "partials/paige/links.html" at <partial "paige/link.html" (dict "href" "paige/bootstrap-icons/bootstrap-icons.css")>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\link.html:20:28": execute of template failed: template: partials/paige/link.html:20:28: executing "partials/paige/link.html" at <resources.ExecuteAsTemplate>: error calling ExecuteAsTemplate: type string not supported in Resource transformations
Error: Error building site: failed to render pages: render of "page" failed: "C:\Users\AnimMouse\Desktop\paige\layouts\_default\baseof.html:5:7": execute of template failed: template: _default/paige/search.html:5:7: executing "_default/paige/search.html" at <partial "paige/head.html" $page>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\head.html:12:7": execute of template failed: template: partials/paige/head.html:12:7: executing "partials/paige/head.html" at <partial "paige/links.html" $page>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\links.html:16:3": execute of template failed: template: partials/paige/links.html:16:3: executing "partials/paige/links.html" at <partial "paige/link.html" (dict "href" "paige/bootstrap-icons/bootstrap-icons.css")>: error calling partial: "C:\Users\AnimMouse\Desktop\paige\layouts\partials\paige\link.html:20:28": execute of template failed: template: partials/paige/link.html:20:28: executing "partials/paige/link.html" at <resources.ExecuteAsTemplate>: error calling ExecuteAsTemplate: type string not supported in Resource transformations
Total in 225 ms

@willfaught
Copy link
Owner

@AnimMouse Thanks for your report.

WARN 2023/02/26 16:37:20 Module "paige" is not compatible with this Hugo version
ERROR 2023/02/26 17:40:23 invalid resource: "paige/bootstrap-icons/bootstrap-icons.css"

In the latest version, the setup instructions have changed:

  • Paige requires the extended version of Hugo because the image shortcode converts to webp by default, and setting the color config transpiles Sass.
  • Node.js is required for external dependencies

This is the current version:

  1. Install Hugo (the extended version is required).

    For Homebrew on Mac:

    $ brew install hugo
  2. Install Node.

    For Homebrew on Mac:

    $ brew install node
  3. Create a site:

    $ hugo new site yourproject
  4. Create a post:

    $ cd yourproject
    $ hugo new my-post.md

The run instructions have also changed:

  • Hugo must generate package.json or modify yours to include Paige's deps
  • You must run npm install

This is the current version:

$ cd yourproject
$ hugo mod npm pack
$ npm install
$ hugo server -D

Note that the current version is v0.41.2 as of this writing.

Would you please try running hugo mod npm pack and npm install, then try again?

@AnimMouse
Copy link
Author

@willfaught

This is the first time I have encountered a Hugo theme that requires npm install to work, I was wondering how can I run this theme inside Cloudflare Pages, like if I should include the node_modules folder inside the repository, but anyway, I have successfully built this theme on Windows 11 and Windows 10, including on a GitHub runner running Windows Server. Thanks for the bug fix and the theme!

P.S. I agree with this, instead of exampleSite/content/content, it should be exampleSite/content/posts, as content/content is confusing.

@willfaught
Copy link
Owner

I have successfully built this theme on Windows 11 and Windows 10, including on a GitHub runner running Windows Server

@AnimMouse Thank you for your report!

This is the first time I have encountered a Hugo theme that requires npm install to work

I thought it would be good to keep deps out of the repo to make it smaller. It's already too large, in my opinion. I'm going to try to slim it down in the future. Fortunately, Hugo supports this.

I was wondering how can I run this theme inside Cloudflare Pages, like if I should include the node_modules folder inside the repository

How are you deploying to Cloudflare Pages?

Are you using https://github.com/cloudflare/pages-action in a GitHub workflow? If so, the doc there says you can put your own build actions in the middle:

on: [push]

jobs:
  publish:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      deployments: write
    name: Publish to Cloudflare Pages
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      # Run a build step here if your project requires

      - name: Publish to Cloudflare Pages
        uses: cloudflare/pages-action@v1
        with:
          apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
          accountId: YOUR_ACCOUNT_ID
          projectName: YOUR_PROJECT_NAME
          directory: YOUR_ASSET_DIRECTORY
          # Optional: Enable this if you want to have GitHub Deployments triggered
          gitHubToken: ${{ secrets.GITHUB_TOKEN }}

You can put npm install there. For example:

- name: Build
  run: |
    npm build
    hugo build # ...flags

All the GitHub runners have npm installed.

See the changes to .github/workflows/pages.yml in 24be3b3 for an example of how Paige does it for the example site.

Thanks for the bug fix and the theme!

My pleasure.

@willfaught
Copy link
Owner

I agree with this, instead of exampleSite/content/content, it should be exampleSite/content/posts, as content/content is confusing.

I wasn't thrilled with the name, either, but I couldn't think of a better one. Suggestions are welcome.

@rogerssam
Copy link

I agree with this, instead of exampleSite/content/content, it should be exampleSite/content/posts, as content/content is confusing.

I wasn't thrilled with the name, either, but I couldn't think of a better one. Suggestions are welcome.

I personally use blog, but posts is pretty common.

@willfaught
Copy link
Owner

@rogerssam Take a look at the current menu of the exampleSite. "Content" is the name of a section that shows how standard content is displayed in the theme. It's adjacent to other sections that show off the theme's shortcodes ("Shortcodes"), layouts ("Layouts"), and so on. There's no single "posts" or "blog" section that can correspond to the "content" section in this context.

Some alternative section names that seemed worse than "Content" to me:

  • HTML
  • Media
  • Display
  • Data

I couldn't think of anything better. 🤷‍♂️

@rogerssam
Copy link

Yeah fair comment, I see what you mean.

You could call the section name "List-style content"? I realise it's long (not ideal), but perhaps clearer what it's demoing? Or maybe even just "Lists" or "Articles"? I would still suggest that "Posts" would give that information to new users because I figure most people are going to want to use that section for blog-style content, so making it clear that's where/how it will display is probably useful.

You could also change this line to something like "Demonstrations of Paige list-style content (suitable for blogs, articles etc)".

At the end of the day it probably doesn't matter too much :) Thanks for your work with this theme - it's very impressive!

@willfaught
Copy link
Owner

You could call the section name "List-style content"? I realise it's long (not ideal), but perhaps clearer what it's demoing? Or maybe even just "Lists" or "Articles"? I would still suggest that "Posts" would give that information to new users because I figure most people are going to want to use that section for blog-style content, so making it clear that's where/how it will display is probably useful.

The other sections also have lists of links to pages in those sections, so it would be confusing for only one of them to be called that. That name also wouldn't describe what kind of pages are in that section. Hence, the current situation. :) Thanks for your suggestions.

@AnimMouse
Copy link
Author

@willfaught

How are you deploying to Cloudflare Pages?

I'm currently using Cloudflare Pages' own builder, so that I don't unnecessarily use my GitHub Actions runner minutes, but since there is no way to do npm install inside Cloudflare Pages' builder, maybe I will go to GitHub Actions route using cloudflare/pages-action just like you said.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants