TOCSS-DART: failed to transform "scss/main.scss" execute permissions

I have read every single article relating to this error and not a single solution has worked for me.

Error

hugo v0.111.1-39a4a3cf676533859217805c36181c7a3dfa321c+extended linux/amd64 BuildDate=2023-03-02T10:08:26Z VendorInfo=snap:0.111.1
Error: Error building site: TOCSS-DART: failed to transform "scss/main.scss" (text/x-scss): got 
unexpected EOF when executing "dart-sass-embedded". The user running hugo must have read and
 execute permissions on this program. With execute permissions only, this error is thrown.

My configuration

  • Installed hugo extended and dart-sass-embedded through snap.
  • Whether dart-sass-embedded is on the path makes no difference
  • The files and directories in the project structure have the standard permissions

dart-sass-embedded has the following permissions (which are unchangeable b/c of snap)
lrwxrwxrwx 1 root root 13 Mar 3 14:40 /snap/bin/dart-sass-embedded -> /usr/bin/snap

Path: /snap/bin/dart-sass-embedded:

head.html (gets included in index.html)

{{ $opts := dict "transpiler" "dartsass" }}
{{ $scss := resources.Get "scss/main.scss" }}
{{ $styles := $scss | resources.ToCSS $opts }}
<link rel="stylesheet" href="{{ $styles.RelPermalink }}" />

Solution attemps

  • Reinstalled hugo and dart-sass-embedded (triple checking it is the extended hugo)
  • Created a clean project to make sure it is not project specific
  • Updated packages on linux
  • Restored project files to standard permissions (in case it was Syncthing’s fault)

Comments

This is not the first time where I begin to code for the day, with 0 modification since I last used hugo, and scss compilation refuses to work. The only pattern is that when I use Syncthing to synchronize files across my desktop and laptop, this seems to happen. However, no files other than the project directory are transferred.

If I remove the scss compilation lines the site appears with no styling (as expected).

Project structure

├── archetypes
│   ├── blog.md
│   └── default.md
├── config.toml
├── content
│   ├── about me.md
│   ├── blog
│   │   └── post.md
│   └── journey
│       ├── _index.md
├── data
├── layouts
│   └── shortcodes
│       ├── slideshow.html
│       └── slides.html
├── public
├── resources
│   └── _gen
│       ├── assets
│       │       └── scss
│       │           ├── main.scss_c70ce94df64e4b85862f2e706592873a.content
│       │           ├── main.scss_c70ce94df64e4b85862f2e706592873a.json
│       │           ├── main.scss_f300667da4f5b5f84e1a9e0702b2fdde.content
│       │           └── main.scss_f300667da4f5b5f84e1a9e0702b2fdde.json
│       └── images
├── static
│   └── images
└── themes
    └── MyTheme
        ├── archetypes
        │   ├── blog.md
        │   ├── default.md
        │   ├── journeylog.md
        │   └── journey.md
        ├── assets
        │   └── scss
        │       ├── main.scss
        ├── layouts
        │   ├── 404.html
        │   ├── blog
        │   │   └── blog-home.html
        │   ├── _default
        │   │   ├── baseof.html
        │   │   ├── list.html
        │   │   └── single.html
        │   ├── index.html
        │   ├── journey
        │   │   ├── journey.html
        │   │   └── journey-list.html
        │   └── partials
        │       ├── footer.html
        │       ├── header.html
        │       ├── head.html
        ├── LICENSE
        ├── static
        │   ├── images
        │   └── js
        │       ├── batch-load.js
        │       └── filter.js
        └── theme.toml

To confirm, it can happen when Syncthing is running, but does not happen if Syncthing is not running.

Is that correct?

Explanation

There was an upstream packaging change that broke the Dart Sass transpiler that is embedded within the Hugo snap package.

https://github.com/gohugoio/hugo/issues/10783

For future reference, once this is fixed, you do not need to install both snaps. If you install the Hugo snap the Dart Sass transpiler is embedded.

Short term work-around

  1. Uninstall the Hugo snap, but keep the dart-sass-embedded snap.
  2. Download and install the Hugo binary from https://github.com/gohugoio/hugo/releases/tag/v0.111.1

My issue is probably uncorrelated with Syncthing. I was grasping at straws for what the issue could be. I will try your workaround.

My workflow is code on my desktop, run syncthing to transfer files to my laptop and then shut syncthing off. Today my laptop unexpectedly died while transferring files and I thought something might have gotten corrupted in the process.

Yeah, syncing files while building a site can cause problems, but not this kind of problem.

We updated the Hugo snap package this morning to fix the internal packaging problem related to Embedded Dart Sass.

If you want to try it out (I have):

sudo snap install hugo --edge

It will be promoted to the “stable” channel when we roll an official release, likely in the next few days.

Thanks for brining this to our attention.

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