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