Hi,
On MacOS, I upgraded Dart Sass and it works fine. However, at Netlify I have constant reproducible same issue:
8:03:38 PM: Start building sites …
8:03:38 PM: hugo v0.139.0-dacef0df92a9a20072b4eaa42003e1a63ace8f41+extended linux/amd64 BuildDate=2024-11-18T16:17:45Z VendorInfo=gohugoio
<omitted>
8:05:27 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
8:05:26 PM: Total in 114717 ms
8:05:26 PM: panic: runtime error: invalid memory address or nil pointer dereference
8:05:26 PM: [signal SIGSEGV: segmentation violation code=0x1 addr=0x8c pc=0x9cbdb9]
8:05:26 PM: goroutine 1 [running]:
8:05:26 PM: github.com/bep/godartsass/v2.(*Transpiler).Close(0x0)
8:05:26 PM: /root/project/gomodcache/github.com/bep/godartsass/v2@v2.3.0/transpiler.go:173 +0x39
8:05:26 PM: github.com/gohugoio/hugo/resources/resource_transformers/tocss/dartsass.(*Client).Close(0xc00082f8ac?)
8:05:26 PM: /root/project/hugo/resources/resource_transformers/tocss/dartsass/client.go:108 +0x17
8:05:26 PM: github.com/gohugoio/hugo/common/types.(*Closers).Close(0xc0003f7b20)
8:05:26 PM: /root/project/hugo/common/types/closer.go:41 +0x8c
8:05:26 PM: github.com/gohugoio/hugo/deps.(*Deps).Close(0xc0007a2690)
8:05:26 PM: /root/project/hugo/deps/deps.go:361 +0x5e
8:05:26 PM: github.com/gohugoio/hugo/commands.(*rootCommand).Close.func1({0x1ce4b60?, 0x0?}, 0xc00025d230?)
8:05:26 PM: /root/project/hugo/commands/commandeer.go:160 +0x1f
8:05:26 PM: github.com/bep/lazycache.(*Cache[...]).DeleteFunc(0x2405d40, 0x2216008)
8:05:26 PM: /root/project/gomodcache/github.com/bep/lazycache@v0.7.0/lazycache.go:68 +0x197
8:05:26 PM: github.com/gohugoio/hugo/commands.(*rootCommand).Close(0x3127230?)
8:05:26 PM: /root/project/hugo/commands/commandeer.go:158 +0x2a
8:05:26 PM: github.com/gohugoio/hugo/commands.Execute({0xc000138090, 0x3, 0x3})
8:05:26 PM: /root/project/hugo/commands/commandeer.go:71 +0x41d
8:05:26 PM: main.main()
8:05:26 PM: /root/project/hugo/main.go:25 +0x56
bep
November 21, 2024, 8:25am
2
I have not seen this in the Dart Sass projects I have tested on, but the stack trace should be enough to fix it. Thanks. See
opened 08:24AM - 21 Nov 24 UTC
Bug
See https://discourse.gohugo.io/t/panic-when-building-on-netlify/52486
```
8… :05:27 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
8:05:26 PM: Total in 114717 ms
8:05:26 PM: panic: runtime error: invalid memory address or nil pointer dereference
8:05:26 PM: [signal SIGSEGV: segmentation violation code=0x1 addr=0x8c pc=0x9cbdb9]
8:05:26 PM: goroutine 1 [running]:
8:05:26 PM: github.com/bep/godartsass/v2.(*Transpiler).Close(0x0)
8:05:26 PM: /root/project/gomodcache/github.com/bep/godartsass/v2@v2.3.0/transpiler.go:173 +0x39
8:05:26 PM: github.com/gohugoio/hugo/resources/resource_transformers/tocss/dartsass.(*Client).Close(0xc00082f8ac?)
8:05:26 PM: /root/project/hugo/resources/resource_transformers/tocss/dartsass/client.go:108 +0x17
8:05:26 PM: github.com/gohugoio/hugo/common/types.(*Closers).Close(0xc0003f7b20)
8:05:26 PM: /root/project/hugo/common/types/closer.go:41 +0x8c
8:05:26 PM: github.com/gohugoio/hugo/deps.(*Deps).Close(0xc0007a2690)
8:05:26 PM: /root/project/hugo/deps/deps.go:361 +0x5e
8:05:26 PM: github.com/gohugoio/hugo/commands.(*rootCommand).Close.func1({0x1ce4b60?, 0x0?}, 0xc00025d230?)
8:05:26 PM: /root/project/hugo/commands/commandeer.go:160 +0x1f
8:05:26 PM: github.com/bep/lazycache.(*Cache[...]).DeleteFunc(0x2405d40, 0x2216008)
8:05:26 PM: /root/project/gomodcache/github.com/bep/lazycache@v0.7.0/lazycache.go:68 +0x197
8:05:26 PM: github.com/gohugoio/hugo/commands.(*rootCommand).Close(0x3127230?)
8:05:26 PM: /root/project/hugo/commands/commandeer.go:158 +0x2a
8:05:26 PM: github.com/gohugoio/hugo/commands.Execute({0xc000138090, 0x3, 0x3})
8:05:26 PM: /root/project/hugo/commands/commandeer.go:71 +0x41d
8:05:26 PM: main.main()
8:05:26 PM: /root/project/hugo/main.go:25 +0x56
```
bep
November 21, 2024, 8:41am
4
OK, I’m pretty sure I know why you get a nilpointer, but that masks another issue: That you don’t have a working Dart Sass version installed. I think you should have some kind of WARNING about this in the log.
Most likely this comes from an old dart-sass-embedded
version.
I found how to install separately Netlify Dart Sass Plugin, but at first try it was failing, I didn’t finish my attempts yet: @gethinode/netlify-plugin-dartsass - npm
Wow and at bottom of this page (I just noticed) link to official Hugo documentation, I’ll try it today:
I followed instructions found at ToCSS | Hugo and it works.
Snippet from netlify.toml
:
[build]
publish = "public"
command = """\
curl -LJO https://github.com/sass/dart-sass/releases/download/${DART_SASS_VERSION}/dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz && \
tar -xf dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz && \
rm dart-sass-${DART_SASS_VERSION}-linux-x64.tar.gz && \
export PATH=/opt/build/repo/dart-sass:$PATH && \
npm ci && \
hugo --gc -b $URL \
"""
[build.environment]
NODE_VERSION = "23.1.0"
HUGO_VERSION = "0.139.0"
HUGO_ENABLEGITINFO = "true"
HUGO_ENV = "production"
GO_VERSION = "1.23.2"
DART_SASS_VERSION = "1.81.0"
TZ = "America/Toronto"
Thank you!
1 Like
system
Closed
November 23, 2024, 3:25pm
7
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.