{"record":{"id":"7554729b6fd31bee","repo":"gohugoio/hugo","slug":"no-dart-sass-binary-found-in-path","errorCode":null,"errorMessage":"no Dart Sass binary found in $PATH","messagePattern":"no Dart Sass binary found in \\$PATH","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"resources/resource_transformers/tocss/dartsass/client.go","lineNumber":52,"sourceCode":"\t\"github.com/spf13/afero\"\n\n\t\"github.com/mitchellh/mapstructure\"\n)\n\n// used as part of the cache key.\nconst transformationName = \"tocss-dart\"\n\n// See https://github.com/sass/dart-sass-embedded/issues/24\n// Note: This prefix must be all lower case.\nconst dartSassStdinPrefix = \"hugostdin:\"\n\nfunc New(fs *filesystems.SourceFilesystem, rs *resources.Spec) (*Client, error) {\n\tif !Supports() {\n\t\treturn &Client{}, nil\n\t}\n\n\tif hugo.DartSassBinaryName == \"\" {\n\t\treturn nil, fmt.Errorf(\"no Dart Sass binary found in $PATH\")\n\t}\n\n\tif !hugo.IsDartSassGeV2() {\n\t\treturn 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\")\n\t}\n\n\tif err := rs.ExecHelper.Sec().CheckAllowedExec(hugo.DartSassBinaryName); err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar (\n\t\ttranspiler *godartsass.Transpiler\n\t\terr        error\n\t\tinfol      = rs.Logger.InfoCommand(\"Dart Sass\")\n\t\twarnl      = rs.Logger.WarnCommand(\"Dart Sass\")\n\t)\n\n\ttranspiler, err = godartsass.Start(godartsass.Options{","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/gohugoio/hugo/blob/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/resources/resource_transformers/tocss/dartsass/client.go#L34-L70","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before: no binary\n$ hugo\nERROR: no Dart Sass binary found in $PATH\n\n// after\n$ npm install -g sass\n$ hugo","handlingStrategy":"validation","validationCode":"// Probe PATH for the Dart Sass binary before building.\nimport \"os/exec\"\n\nfunc dartSassAvailable() bool {\n    _, err := exec.LookPath(\"sass\") // or dart-sass-embedded\n    return err == nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["dart-sass","sass","environment","binary-not-found","path"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}