gohugoio/hugo · error
no Dart Sass binary found in $PATH
Error message
no Dart Sass binary found in $PATH
What it means
Returned by the Dart Sass client constructor when hugo.DartSassBinaryName is empty, meaning Hugo probed $PATH and found no dart-sass-embedded / sass binary. Without the binary, Dart Sass transpilation cannot run, so ToCSS with transpiler='dartsass' fails (or falls back depending on cache config).
Solutions
- Install Dart Sass embedded and ensure it is on $PATH: see https://gohugo.io/functions/css/sass/#dart-sass for the official install steps (e.g. download dart-sass-embedded release or `npm install -g sass`).
- Verify with `sass --version` from the same shell/environment Hugo runs in.
- Alternatively set transpiler='libsass' (requires Hugo extended) if you cannot install Dart Sass.
Example fix
// before: no binary $ hugo ERROR: no Dart Sass binary found in $PATH // after $ npm install -g sass $ hugo
Defensive patterns
Strategy: validation
Validate before calling
// Probe PATH for the Dart Sass binary before building.
import "os/exec"
func dartSassAvailable() bool {
_, err := exec.LookPath("sass") // or dart-sass-embedded
return err == nil
} Prevention
- Install Dart Sass embedded on all build machines; document it in README/CI.
- Add a pre-build CI step: `sass --version` to fail fast if missing.
- Pin transpiler choice per project so missing-binary failures are obvious.
When it happens
Trigger: Calling css.Sass / css.ToCSS with options transpiler='dartsass' (the default for .scss) on a machine where the Dart Sass embedded binary is not installed or not on $PATH. New() checks hugo.DartSassBinaryName and returns this error.
Common situations: Fresh CI/CD runner without Dart Sass installed, local dev after uninstalling sass, a Docker image that lacks the binary, or PATH not propagating the install into Hugo's process environment.
Related errors
- unsupported Dart Sass version detected, please upgrade to…
- could not find in the import context
- got unexpected EOF when executing
- pandoc not found in $PATH, cannot render
- failed to execute 'go
AI-assisted analysis of gohugoio/hugo@52c9bd7908 (2026-08-09).
Data as JSON: /api/errors/7554729b6fd31bee.
Report an issue: GitHub.
Appendix: source
Thrown at resources/resource_transformers/tocss/dartsass/client.go:52
"github.com/spf13/afero"
"github.com/mitchellh/mapstructure"
)
// used as part of the cache key.
const transformationName = "tocss-dart"
// See https://github.com/sass/dart-sass-embedded/issues/24
// Note: This prefix must be all lower case.
const dartSassStdinPrefix = "hugostdin:"
func New(fs *filesystems.SourceFilesystem, rs *resources.Spec) (*Client, error) {
if !Supports() {
return &Client{}, nil
}
if hugo.DartSassBinaryName == "" {
return nil, fmt.Errorf("no Dart Sass binary found in $PATH")
}
if !hugo.IsDartSassGeV2() {
return nil, fmt.Errorf("unsupported Dart Sass version detected, please upgrade to Dart Sass 1.63.0 or later, see https://gohugo.io/functions/css/sass/#dart-sass")
}
if err := rs.ExecHelper.Sec().CheckAllowedExec(hugo.DartSassBinaryName); err != nil {
return nil, err
}
var (
transpiler *godartsass.Transpiler
err error
infol = rs.Logger.InfoCommand("Dart Sass")
warnl = rs.Logger.WarnCommand("Dart Sass")
)
transpiler, err = godartsass.Start(godartsass.Options{View on GitHub (pinned to 52c9bd7908)