Error building site: TOCSS-Dart

The line above from the hugo env output points to the problem.

Solution

Install Dart Sass using one of the methods described here:
https://gohugo.io/functions/resources/tocss/#dart-sass

To verify installation and path precedence:

sass --embedded --version

You should see something like:

{
  "protocolVersion": "2.4.0",
  "compilerVersion": "1.70.0",
  "implementationVersion": "1.70.0",
  "implementationName": "dart-sass",
  "id": 0
}

When you run hugo env you should see something like:

hugo v0.123.0-DEV-4d98b0ed6a8aa4219fcc089228446cc480b31862+extended linux/amd64 BuildDate=2024-01-31T12:43:46Z
GOOS="linux"
GOARCH="amd64"
GOVERSION="go1.21.6"
github.com/sass/libsass="3.6.5"
github.com/webmproject/libwebp="v1.3.2"
github.com/sass/dart-sass/protocol="2.4.0"
github.com/sass/dart-sass/compiler="1.70.0"
github.com/sass/dart-sass/implementation="1.70.0"

Explanation…

When Hugo transpiles Sass to CSS it “shells out” to Dart Sass using the Embedded Sass Protocol via the --embedded CLI flag for the Dart Sass executable.

The Node.js Dart Sass implementation specifically excludes this capability, which is why this installation method is not listed in the Hugo documentation referenced above.

1 Like