{"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/8a468df065a75c1c7cf9f6850f32148746590ea5/resources/resource_transformers/tocss/dartsass/client.go#L34-L70","documentation":"Raised in the Dart Sass client constructor when Hugo is configured to use the `dartsass` transpiler but no `sass` (dart-sass-embedded) executable was found in $PATH at startup (hugo.DartSassBinaryName is empty). Hugo shells out to the Dart Sass binary rather than bundling it, so it must be installed separately.","triggerScenarios":"A template pipeline using `css.Sass` / `toCSS` with `transpiler = \"dartsass\"` (or a theme requiring it) on a machine where the `sass` binary is not installed or not on the PATH visible to Hugo.","commonSituations":"Fresh dev machines, CI runners (GitHub Actions, Netlify, Vercel) without a dart-sass install step, Snap-packaged Hugo which has a confined PATH, or Docker images containing only the hugo binary.","solutions":["Install Dart Sass and ensure `sass --version` works in the same shell: `brew install sass/sass/sass`, `choco install sass`, `npm i -g sass`, or download from https://github.com/sass/dart-sass/releases","In CI, add an install step (e.g. GitHub Actions: install dart-sass before `hugo`)","If PATH differs for the build process (systemd, snap), add the sass binary directory to that PATH","Alternatively switch the pipeline to `transpiler = \"libsass\"` if the built-in transpiler suffices"],"exampleFix":"# before (CI)\n- run: hugo --minify\n# after\n- run: |\n    curl -sL https://github.com/sass/dart-sass/releases/download/1.77.8/dart-sass-1.77.8-linux-x64.tar.gz | tar xz\n    export PATH=\"$PWD/dart-sass:$PATH\"\n    hugo --minify","handlingStrategy":"validation","validationCode":"# before build\ncommand -v sass || { echo 'install dart-sass'; exit 1; }","typeGuard":null,"tryCatchPattern":"{{ if hugo.IsExtended }}{{ with try (. | css.Sass (dict \"transpiler\" \"dartsass\")) }}{{ with .Err }}{{ warnf \"%s\" . }}{{ end }}{{ end }}{{ end }}","preventionTips":["Install the dart-sass binary and ensure `sass` is on PATH in dev and CI (e.g. via the dart-sass release archive or package manager)","In CI images/GitHub Actions, add an explicit dart-sass install step — Hugo does not bundle it","Only set transpiler = \"dartsass\" when the binary is guaranteed present; otherwise use the default libsass or precompiled CSS","Document the dart-sass requirement in the project README"],"tags":["hugo","dart-sass","scss","environment","path","ci"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}