gohugoio / hugo

The world’s fastest framework for building websites.
https://gohugo.io
Apache License 2.0
74.73k stars 7.45k forks source link

Build fails with changed mount behavior `assets` directory #12175

Closed h-enk closed 6 months ago

h-enk commented 6 months ago

Module mounts behavior of the assets directory changed with Hugo v0.123.0 and later.

Known inpact: all Doks and Hyas users.

Replicate

Clone repository

git clone https://github.com/h-enk/hyas-hugo-v0.123.6.git

Install dependencies

npm install

Run development server

npm run dev

Module mounts (default settings)

config/_default/module.toml

## assets
[[mounts]]
  source = "node_modules/@hyas/core/assets"
  target = "assets"

[[mounts]]
  source = "assets"
  target = "assets"

Result: NOK

execute of template failed: template: partials/head/libsass.html:9:36: executing "partials/head/libsass.html" at <$css.Permalink>: error calling Permalink: operation not supported on directory ""

Module mounts (temporary fix)

config/_default/module.toml

## assets
[[mounts]]
  source = "node_modules/@hyas/core/assets"
  target = "assets"
  excludeFiles = ["scss/app.scss"]

[[mounts]]
  source = "assets"
  target = "assets"

Result: OK

Resources

jmooring commented 6 months ago

@h-enk

Here's what I did on a virgin Debian system with node v20.11.1:

git clone https://github.com/h-enk/hyas-hugo-v0.123.6.git
cd hyas-hugo-v0.123.6/
npm install

Here's what I got:

npm notice 
npm notice New minor version of npm available! 10.2.4 -> 10.5.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.5.0
npm notice Run npm install -g npm@10.5.0 to update!
npm notice 
npm ERR! code 1
npm ERR! path /home/jmooring/temp/hyas-hugo-v0.123.6/node_modules/gethyas
npm ERR! command failed
npm ERR! command sh -c hugo-installer --version otherDependencies.hugo --extended --destination node_modules/.bin/hugo

npm ERR! A complete log of this run can be found in: /home/jmooring/.npm/_logs/2024-03-01T00_57_30_589Z-debug-0.log

I tested on a virgin Debian system because I couldn't get it to work on my Ubuntu system either.

h-enk commented 6 months ago

Here's a repository that doesn't (try to) install Hugo locally:

ytrepidorosonomous commented 6 months ago

Can confirm the issue on Windows

$ hugo env
hugo v0.123.6-92684f9a26838a46d1a81e3c250fef5207bcb735+extended windows/amd64 BuildDate=2024-02-28T18:29:40Z VendorInfo=gohugoio
GOOS="windows"
GOARCH="amd64"
GOVERSION="go1.22.0"
github.com/sass/libsass="3.6.5"
github.com/webmproject/libwebp="v1.3.2"
bep commented 6 months ago

I will have a look at this and see if there is an easy fix, but I have said it before and I will say it again: The overlay file system is built horizontally (project -> module1 -> module2); the file mounts were never meant to have advanced vertical merge semantics, so you should try to avoid that (which I suspect should be fairly simple in the above case).

@h-enk could you edit the issue title to be more specific and, if possible, with a less negative tone.

github-actions[bot] commented 5 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.