Error using dart-sass: 'fails to transform'

After successfully (I believe) installing dart-sass-embedded on my local machine, and setting up my template using

{{ $cssOpts := (dict "targetPath" "css/bradbice.css" "enableSourceMap" true "transpiler" "dartsass" ) }}
{{ $scss := resources.Get "scss/bradbice.scss" }}
{{ $styles := $scss | resources.ToCSS $cssOpts }}
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" media="screen, print">

To verify dart-sass in installed, sass --version gives me: 1.49.9

Running hugo gives me:

Start building sites … 
hugo v0.94.1+extended darwin/arm64 BuildDate=unknown
Error: Error building site: TOCSS-DART: failed to transform "scss/bradbice.scss" (text/x-scss): unexpected EOF
Total in 266 ms

Support posts have resolved this by recommending users install the Extended version of Hugo, however as you can see that’s what I’m using.

For dart-sass-embedded, running ✗ command -v dart-sass-embedded gets me:

/usr/local/bin/dart-sass-embedded

And in each of my ~/.bash_profile and ~/.zshrc I have:

export PATH="/usr/local/bin:$PATH"

Removing "transpiler" "dartsass" allows Hugo to process successfully.

Is anyone familiar with what may be the problem here?

The user running hugo must have read and execute permissions on /usr/local/bin/dart-sass-embedded. With execute permissions only, the following error is thrown:

Error building site: TOCSS-DART: failed to transform "scss/main.scss" (text/x-scss): unexpected EOF
1 Like

That’s it! Thanks very much, I had forgotten that step when shifting some things around.

Using chmod 755 dart-sass-embedded did the trick.

We should be able to create a better error message in that, I assume, common error situation. Could someone create a GitHub issue to remind me?

1 Like

Created Error messages for dart-sass permissions errors should be more descriptive · Issue #9662 · gohugoio/hugo · GitHub

2 Likes

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