Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document usage of official Docker image #2741

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jmooring
Copy link
Member

@jmooring jmooring commented Oct 16, 2024

Closes #2727

Previews:

@jmooring
Copy link
Member Author

jmooring commented Oct 16, 2024

It would be good if we could test the commands and functionality for each operating system.

OS Tester Result
BSD ? ?
Linux jmooring pass
macOS ? ?
Windows jmooring pass

Note that one of the documented prerequisites, at least on Linux, is creation of the Hugo cache directory. When testing locally on Linux, if $HOME/.cache/hugo_cache does not exist, Hugo creates the directory but the owner and group are set to root. This causes Hugo to throw errors such as:

Error: failed to load modules: failed to download modules: failed to execute 'go [mod download -modcacherw]': failed to execute binary "go" with args [mod download -modcacherw]: go: github.com/jmooring/[email protected]: mkdir /cache/modules: permission denied
*errors.errorString

Command to create the Hugo cache directory:

OS Command
BSD mkdir -p $HOME/.cache/hugo_cache
Linux mkdir -p $HOME/.cache/hugo_cache
macOS mkdir -p $HOME/Library/Caches/hugo_cache
Windows mkdir -f $Env:LocalAppData/hugo_cache (must use Powershell)

Testing

The site that we are using tests these these features and capabilities:

  1. Including content from a Hugo module
  2. Transpiling Sass to CSS using Dart Sass
  3. Vendor prefixing of CSS rules using the postcss, postcss-cli, and autoprefixer Node.js packages
  4. Processing CSS files using the tailwindcss and @tailwindcss-cli Node.js packages
  5. Encoding images to the WebP format to verify that we're using Hugo's extended edition
  6. Including a content file named hugö.md to verify that the Git core.quotepath setting is false1

Commands for testing on each operating system:

BSD

mkdir -p $HOME/.cache/hugo_cache
git clone https://github.com/jmooring/hugo-docker-test
cd hugo-docker-test
docker run --rm -v .:/project -v $HOME/.cache/hugo_cache:/cache -p 1313:1313 ghcr.io/gohugoio/hugo:v0.136.5 server --bind="0.0.0.0"

Linux

mkdir -p $HOME/.cache/hugo_cache
git clone https://github.com/jmooring/hugo-docker-test
cd hugo-docker-test
docker run --rm -v .:/project -v $HOME/.cache/hugo_cache:/cache -p 1313:1313 ghcr.io/gohugoio/hugo:v0.136.5 server --bind="0.0.0.0"

macOS

mkdir -p $HOME/Library/Caches/hugo_cache
git clone https://github.com/jmooring/hugo-docker-test
cd hugo-docker-test
docker run --rm -v .:/project -v $HOME/Library/Caches/hugo_cache:/cache -p 1313:1313 ghcr.io/gohugoio/hugo:v0.136.5 server --bind="0.0.0.0"

Windows (use Powershell to run these commands)

mkdir -f $Env:LocalAppData/hugo_cache
git clone https://github.com/jmooring/hugo-docker-test
cd hugo-docker-test
docker run --rm -v .:/project -v $Env:LocalAppData/hugo_cache:/cache -p 1313:1313 ghcr.io/gohugoio/hugo:v0.136.5 server --bind="0.0.0.0"

Footnotes

  1. See issue #9810. Git's core.quotepath setting is false if /other/hugö has a non-zero "last modified" date.

@jmooring jmooring force-pushed the document-docker-image branch 4 times, most recently from 987ac24 to 1663ed5 Compare October 17, 2024 03:37
@jmooring jmooring marked this pull request as ready for review October 17, 2024 03:38
@jmooring
Copy link
Member Author

@bep If you have the time and inclination, I would appreciate a review and testing of the Docker instructions for macOS:
https://deploy-preview-2741--gohugoio.netlify.app/installation/macos/#docker-container

As noted in my previous comment, the Linux and Windows instructions work great.

I have no interest in firing up a BSD VM, so that information will be published untested.

@bep
Copy link
Member

bep commented Oct 17, 2024

Your test site fails on my ARM64 MacBook (I'm pretty sure I tested a site with Dart Sass on ...). The error message is clear and simple to understand, though.

I have created a new milestone and will try to fix this/these soon: https://github.com/gohugoio/hugo/milestone/313

Edit in:

  • The test site runs fine on Docker images built locally on my MacBook (even if I rm the Hugo cache folder before running). This makes it really easy to debug ... Not.

@bep
Copy link
Member

bep commented Oct 17, 2024

OK, the image in 0.136.2 looks good to me on MacOS (ARM64) for the test site above.

Note that both of these now work:

docker run --rm -v .:/project -v $HOME/Library/Caches/hugo_cache:/cache -p 1313:1313 ghcr.io/gohugoio/hugo:v0.136.2 server --bind="0.0.0.0"
docker run --rm -v .:/project -p 1313:1313 ghcr.io/gohugoio/hugo:v0.136.2 server --bind="0.0.0.0"

@jmooring
Copy link
Member Author

Note that both of these now work

I haven't looked at the latest Dockerfile, but why would I use the second one (no persistent cache).

@bep
Copy link
Member

bep commented Oct 17, 2024

I haven't looked at the latest Dockerfile, but why would I use the second one (no persistent cache).

I wouldn't, but for small/simple blogs it does not make much difference in build speed ... As to documentation I would just document the cache variant. But at least now, the user does not have to create the cache dir manually.

@jmooring jmooring force-pushed the document-docker-image branch from 02a6421 to fdfb55e Compare October 19, 2024 23:02
@jmooring
Copy link
Member Author

On hold pending resolution of gohugoio/hugo#12970 and gohugoio/hugo#12971. Once resolved, test all operating systems without creating the cacheDir to see if that step is still required.

Copy link
Contributor

@dvdksn dvdksn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest using a volume instead of a bind mount for the hugo cache:

docker volume create hugo_cache
docker run -v hugo_cache:/cache ...

You generally don't want to mix cache/dependencies for host and containers since they might run different OSes, which can cause problems.

The same is true for node_modules. Mounting node_modules from the host to a container can easily result in errors, and likewise if you generate node_modules in a container with a bind mount, those node_modules files probably won't work if you try to run hugo directly on the host.

It would probably be good to show how to extend the Hugo image to install node dependencies with a Dockerfile.

FROM ghcr.io/gohugoio/hugo:latest
COPY --chown=hugo:hugo package*.json .
RUN npm ci

And instead of docker run, we could use a compose file:

services:
  server:
    build:
      context: .
    ports:
      - 1313:1313
    command: ["server", "--bind", "0.0.0.0"]
    volumes:
      - ".:/project"
      - "/project/node_modules" # ignore node_modules
      - "hugo_cache:/cache" # persistent cache volume

volumes:
  hugo_cache:

@jmooring
Copy link
Member Author

jmooring commented Oct 22, 2024

@dvdksn @bep Latest test results...

Linux

With or without a pre-existing cache directory, this works:

mkdir -p $HOME/.cache/hugo_cache
git clone https://github.com/jmooring/hugo-docker-test
cd hugo-docker-test
docker run --rm -v .:/project -v $HOME/.cache/hugo_cache:/cache -p 1313:1313 ghcr.io/gohugoio/hugo:latest server --bind="0.0.0.0"

Without a pre-existing cache directory, this fails:

git clone https://github.com/jmooring/hugo-docker-test
cd hugo-docker-test
docker run --rm -v .:/project -v $HOME/.cache/hugo_cache:/cache -p 1313:1313 ghcr.io/gohugoio/hugo:latest server --bind="0.0.0.0"
log
Cloning into 'hugo-docker-test'...
remote: Enumerating objects: 206, done.
remote: Counting objects: 100% (206/206), done.
remote: Compressing objects: 100% (135/135), done.
remote: Total 206 (delta 84), reused 170 (delta 48), pack-reused 0 (from 0)
Receiving objects: 100% (206/206), 18.30 MiB | 12.79 MiB/s, done.
Resolving deltas: 100% (84/84), done.

added 92 packages, and audited 93 packages in 2s

29 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
go: github.com/jmooring/[email protected]: mkdir /cache/modules: permission denied
Hugo provides its own webserver which builds and serves the site.
While hugo server is high performance, it is a webserver with limited options.

The `hugo server` command will by default write and serve files from disk, but
you can render to memory by using the `--renderToMemory` flag. This can be
faster in some cases, but it will consume more memory.

By default hugo will also watch your files for any changes you make and
automatically rebuild the site. It will then live reload any open browser pages
and push the latest content to them. As most Hugo sites are built in a fraction
of a second, you will be able to save and see your changes nearly instantly.

Usage:
  hugo server [command] [flags]
  hugo server [command]

Aliases:
  server, serve

Available Commands:
  trust       Install the local CA in the system trust store.

Flags:
      --appendPort               append port to baseURL (default true)
  -b, --baseURL string           hostname (and path) to the root, e.g. https://spf13.com/
      --bind string              interface to which the server will bind (default "127.0.0.1")
  -D, --buildDrafts              include content marked as draft
  -E, --buildExpired             include expired content
  -F, --buildFuture              include content with publishdate in the future
      --cacheDir string          filesystem path to cache directory
      --cleanDestinationDir      remove files from destination not found in static directories
  -c, --contentDir string        filesystem path to content directory
      --disableBrowserError      do not show build errors in the browser
      --disableFastRender        enables full re-renders on changes
      --disableKinds strings     disable different kind of pages (home, RSS etc.)
      --disableLiveReload        watch without enabling live browser reload on rebuild
      --enableGitInfo            add Git revision, date, author, and CODEOWNERS info to the pages
      --forceSyncStatic          copy all files when static is changed.
      --gc                       enable to run some cleanup tasks (remove unused cache files) after the build
  -h, --help                     help for server
      --ignoreCache              ignores the cache directory
  -l, --layoutDir string         filesystem path to layout directory
      --liveReloadPort int       port for live reloading (i.e. 443 in HTTPS proxy situations) (default -1)
      --minify                   minify any supported output format (HTML, XML etc.)
  -N, --navigateToChanged        navigate to changed content file on live browser reload
      --noBuildLock              don't create .hugo_build.lock file
      --noChmod                  don't sync permission mode of files
      --noHTTPCache              prevent HTTP caching
      --noTimes                  don't sync modification time of files
      --panicOnWarning           panic on first WARNING log
      --poll string              set this to a poll interval, e.g --poll 700ms, to use a poll based approach to watch for file system changes
  -p, --port int                 port on which the server will listen (default 1313)
      --pprof                    enable the pprof server (port 8080)
      --printI18nWarnings        print missing translations
      --printMemoryUsage         print memory usage to screen at intervals
      --printPathWarnings        print warnings on duplicate target paths etc.
      --printUnusedTemplates     print warnings on unused templates.
      --renderSegments strings   named segments to render (configured in the segments config)
      --renderStaticToDisk       serve static files from disk and dynamic files from memory
      --templateMetrics          display metrics about template executions
      --templateMetricsHints     calculate some improvement hints when combined with --templateMetrics
  -t, --theme strings            themes to use (located in /themes/THEMENAME/)
      --tlsAuto                  generate and use locally-trusted certificates.
      --tlsCertFile string       path to TLS certificate file
      --tlsKeyFile string        path to TLS key file
      --trace file               write trace to file (not useful in general)
  -w, --watch                    watch filesystem for changes and recreate as needed (default true)

Global Flags:
      --clock string               set the clock used by Hugo, e.g. --clock 2021-11-06T22:30:00.00+09:00
      --config string              config file (default is hugo.yaml|json|toml)
      --configDir string           config dir (default "config")
      --debug                      debug output
  -d, --destination string         filesystem path to write files to
  -e, --environment string         build environment
      --ignoreVendorPaths string   ignores any _vendor for module paths matching the given Glob pattern
      --logLevel string            log level (debug|info|warn|error)
      --quiet                      build in quiet mode
  -M, --renderToMemory             render to memory (mostly useful when running the server)
  -s, --source string              filesystem path to read files relative from
      --themesDir string           filesystem path to themes directory
  -v, --verbose                    verbose output

Use "hugo server [command] --help" for more information about a command.

Error: command error: failed to load modules: failed to download modules: failed to execute 'go [mod download -modcacherw]': failed to execute binary "go" with args [mod download -modcacherw]: go: github.com/jmooring/[email protected]: mkdir /cache/modules: permission denied
*errors.errorString

</details>
<br>

<details>
<summary>log</summary>

```text
git clone https://github.com/jmooring/hugo-docker-test
cd hugo-docker-test
docker run --rm -v .:/project -v $Env:LocalAppData/hugo_cache:/cache -p 1313:1313 ghcr.io/gohugoio/hugo:latest server --bind="0.0.0.0"

Windows

With a pre-existing cache directory, this fails:

git clone https://github.com/jmooring/hugo-docker-test
cd hugo-docker-test
docker run --rm -v .:/project -v $Env:LocalAppData/hugo_cache:/cache -p 1313:1313 ghcr.io/gohugoio/hugo:latest server --bind="0.0.0.0"
log
Cloning into 'hugo-docker-test'...
remote: Enumerating objects: 206, done.
remote: Counting objects: 100% (206/206), done.
remote: Compressing objects: 100% (135/135), done.
Receiving objects: 100% (206/206), 18.30 MiB | 13.88 MiB/s, done.0 (from 0)

Resolving deltas: 100% (84/84), done.
PS C:\temp> cd hugo-docker-test
PS C:\temp\hugo-docker-test> docker run --rm -v .:/project -v $Env:LocalAppData/hugo_cache:/cache -p 1313:1313 ghcr.io/gohugoio/hugo:latest server --bind="0.0.0.0"
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/enhanced-resolve/lib/util/path.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/fs-extra/lib/json/output-json-sync.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/fs-extra/lib/json/output-json.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/enhanced-resolve/lib/util/process-browser.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/fast-glob/out/readers/reader.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/yaml/dist/nodes/Collection.js'
npm warn cleanup Failed to remove some directories [
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/@tailwindcss/node',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/@tailwindcss/node/dist'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/@tailwindcss/node/dist'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/@tailwindcss',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/@tailwindcss/node/dist'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/@tailwindcss/node/dist'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/autoprefixer',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/autoprefixer/lib/hacks'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/autoprefixer/lib/hacks'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/fast-glob',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/fast-glob/out/utils'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/fast-glob/out/utils'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/fs-extra',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/fs-extra/lib/ensure'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/fs-extra/lib/ensure'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/@nodelib/fs.walk',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/@nodelib/fs.walk/out/readers'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/@nodelib/fs.walk/out/readers'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/enhanced-resolve',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/enhanced-resolve/lib'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/enhanced-resolve/lib'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/enhanced-resolve/lib'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/enhanced-resolve/lib'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/yaml',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/yaml/browser/dist/nodes'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/yaml/browser/dist/nodes'
npm warn cleanup     }
npm warn cleanup   ]
npm warn cleanup ]
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/fs-extra/lib/ensure/symlink-paths.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/fast-glob/out/readers/stream.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/fs-extra/lib/ensure/symlink-type.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/fast-glob/out/utils/stream.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/fs-extra/lib/ensure/symlink.js'
npm error code EACCES
npm error syscall mkdir
npm error path /var/hugo/.npm
npm error errno -13
npm error
npm error Your cache folder contains root-owned files, due to a bug in
npm error previous versions of npm which has since been addressed.
npm error
npm error To permanently fix this problem, please run:
npm error   sudo chown -R 1000:1000 "/var/hugo/.npm"
npm error Log files were not written due to an error writing to the directory: /var/hugo/.npm/_logs
npm error You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
hugo: downloading modules …
hugo: collected modules in 2881 ms
Watching for changes in /project/{archetypes,assets,content,layouts,package.json,postcss.config.js,static}
Watching for config changes in /project/config/_default, /project/go.mod
Start building sites …
hugo v0.136.2+extended linux/amd64 BuildDate=unknown VendorInfo=docker

ERROR render of "page" failed: "/project/layouts/_default/tailwindcss.html:16:23": execute of template failed: template: _default/tailwindcss.html:16:23: executing "main" at <.Content>: error calling Content: TAILWINDCSS: failed to transform "/temp/css" (application/octet-stream): npm error code EACCES
npm error syscall mkdir
npm error path /var/hugo/.npm
npm error errno EACCES
npm error
npm error Your cache folder contains root-owned files, due to a bug in
npm error previous versions of npm which has since been addressed.
npm error
npm error To permanently fix this problem, please run:
npm error   sudo chown -R 1000:1000 "/var/hugo/.npm"
npm error Log files were not written due to an error writing to the directory: /var/hugo/.npm/_logs
npm error You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
ERROR POSTCSS: failed to transform "/temp/css" (application/octet-stream): npm error code EACCES
npm error syscall mkdir
npm error path /var/hugo/.npm
npm error errno EACCES
npm error
npm error Your cache folder contains root-owned files, due to a bug in
npm error previous versions of npm which has since been addressed.
npm error
npm error To permanently fix this problem, please run:
npm error   sudo chown -R 1000:1000 "/var/hugo/.npm"
npm error Log files were not written due to an error writing to the directory: /var/hugo/.npm/_logs
npm error You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
ERROR TAILWINDCSS: failed to transform "/temp/css" (application/octet-stream): npm error code EACCES
npm error syscall mkdir
npm error path /var/hugo/.npm
npm error errno EACCES
npm error
npm error Your cache folder contains root-owned files, due to a bug in
npm error previous versions of npm which has since been addressed.
npm error
npm error To permanently fix this problem, please run:
npm error   sudo chown -R 1000:1000 "/var/hugo/.npm"
npm error Log files were not written due to an error writing to the directory: /var/hugo/.npm/_logs
npm error You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
Built in 845 ms
Error: error building site: render: failed to render pages: render of "page" failed: "/project/layouts/_default/postcss.html:20:23": execute of template failed: template: _default/postcss.html:20:23: executing "main" at <.Content>: error calling Content: POSTCSS: failed to transform "/temp/css" (application/octet-stream): npm error code EACCES
npm error syscall mkdir
npm error path /var/hugo/.npm
npm error errno EACCES
npm error
npm error Your cache folder contains root-owned files, due to a bug in
npm error previous versions of npm which has since been addressed.
npm error
npm error To permanently fix this problem, please run:
npm error   sudo chown -R 1000:1000 "/var/hugo/.npm"
npm error Log files were not written due to an error writing to the directory: /var/hugo/.npm/_logs
npm error You can rerun the command with `--loglevel=verbose` to see the logs in your terminal

Without a pre-existing cache directory, this also fails:

mkdir -f $Env:LocalAppData/hugo_cache
git clone https://github.com/jmooring/hugo-docker-test
cd hugo-docker-test
docker run --rm -v .:/project -v $Env:LocalAppData/hugo_cache:/cache -p 1313:1313 ghcr.io/gohugoio/hugo:latest server --bind="0.0.0.0"
log
Cloning into 'hugo-docker-test'...
remote: Enumerating objects: 206, done.
remote: Counting objects: 100% (206/206), done.
remote: Compressing objects: 100% (135/135), done.
remote: Total 206 (delta 84), reused 170 (delta 48), pack-reused 0 (from 0)
Receiving objects: 100% (206/206), 18.30 MiB | 7.40 MiB/s, done.
Resolving deltas: 100% (84/84), done.
PS C:\temp> cd hugo-docker-test
PS C:\temp\hugo-docker-test> docker run --rm -v .:/project -v $Env:LocalAppData/hugo_cache:/cache -p 1313:1313 ghcr.io/gohugoio/hugo:latest server --bind="0.0.0.0"
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/nanoid/non-secure/package.json'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.stat/out/providers/async.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/nanoid/url-alphabet/package.json'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.walk/out/providers/stream.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/caniuse-lite/data/agents.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.walk/out/providers/sync.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.stat/out/index.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.walk/out/readers/sync.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.stat/out/types/index.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/project/node_modules/caniuse-lite/dist'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.scandir/out/providers/async.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.walk/package.json'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.stat/out/settings.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.scandir/out/providers/common.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.stat/out/providers/sync.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/caniuse-lite/data/regions/AI.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.scandir/out/constants.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.walk/README.md'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/caniuse-lite/data/regions/AL.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/nanoid/non-secure/index.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.walk/out/providers/async.d.ts'
npm warn cleanup Failed to remove some directories [
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/browserslist',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/browserslist'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/browserslist'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/fraction.js',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/fraction.js'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/fraction.js'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/browserslist'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/browserslist'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/dependency-graph',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/dependency-graph/lib'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/dependency-graph/lib'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/enhanced-resolve',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/enhanced-resolve/lib'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/enhanced-resolve/lib'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/nanoid',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/nanoid/async'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/nanoid/async'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/@tailwindcss/node',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/@tailwindcss/node/dist'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/@tailwindcss/node/dist'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/fastq',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/fastq'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/fastq'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/chokidar',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/chokidar'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/chokidar'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/@tailwindcss',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/@tailwindcss/node/dist'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/@tailwindcss/node/dist'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/autoprefixer',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/autoprefixer/lib/hacks'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/autoprefixer/lib/hacks'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/fast-glob',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/fast-glob/out/utils'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/fast-glob/out/utils'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/fs-extra',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/fs-extra/lib'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/fs-extra/lib'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/@nodelib/fs.walk',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/@nodelib/fs.walk/out'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/@nodelib/fs.walk/out'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/@nodelib',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/@nodelib/fs.walk/out'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/@nodelib/fs.walk/out'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/@nodelib/fs.stat',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/@nodelib/fs.stat'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/@nodelib/fs.stat'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/yaml',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/yaml/browser/dist'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/yaml/browser/dist'
npm warn cleanup     }
npm warn cleanup   ]
npm warn cleanup ]
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/caniuse-lite/data/regions/alt-af.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.walk/out/readers/async.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/caniuse-lite/data/regions/alt-an.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/project/node_modules/fast-glob/out/providers/matchers'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.walk/out/readers/common.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.scandir/out/index.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/caniuse-lite/data/regions/alt-as.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.walk/out/index.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.scandir/out/types/index.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, lstat '/project/node_modules/fast-glob/out/providers/matchers'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.walk/out/providers/index.d.ts'
npm error code EACCES
npm error syscall mkdir
npm error path /var/hugo/.npm
npm error errno -13
npm error
npm error Your cache folder contains root-owned files, due to a bug in
npm error previous versions of npm which has since been addressed.
npm error
npm error To permanently fix this problem, please run:
npm error   sudo chown -R 1000:1000 "/var/hugo/.npm"
npm error Log files were not written due to an error writing to the directory: /var/hugo/.npm/_logs
npm error You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
hugo: downloading modules …
hugo: collected modules in 2641 ms
Watching for changes in /project/{archetypes,assets,content,layouts,package.json,postcss.config.js,static}
Watching for config changes in /project/config/_default, /project/go.mod
Start building sites …
hugo v0.136.2+extended linux/amd64 BuildDate=unknown VendorInfo=docker

ERROR render of "page" failed: "/project/layouts/_default/postcss.html:20:23": execute of template failed: template: _default/postcss.html:20:23: executing "main" at <.Content>: error calling Content: POSTCSS: failed to transform "/temp/css" (application/octet-stream): npm error code EACCES
npm error syscall mkdir
npm error path /var/hugo/.npm
npm error errno EACCES
npm error
npm error Your cache folder contains root-owned files, due to a bug in
npm error previous versions of npm which has since been addressed.
npm error
npm error To permanently fix this problem, please run:
npm error   sudo chown -R 1000:1000 "/var/hugo/.npm"
npm error Log files were not written due to an error writing to the directory: /var/hugo/.npm/_logs
npm error You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
ERROR TAILWINDCSS: failed to transform "/temp/css" (application/octet-stream): npm error code EACCES
npm error syscall mkdir
npm error path /var/hugo/.npm
npm error errno EACCES
npm error
npm error Your cache folder contains root-owned files, due to a bug in
npm error previous versions of npm which has since been addressed.
npm error
npm error To permanently fix this problem, please run:
npm error   sudo chown -R 1000:1000 "/var/hugo/.npm"
npm error Log files were not written due to an error writing to the directory: /var/hugo/.npm/_logs
npm error You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
ERROR POSTCSS: failed to transform "/temp/css" (application/octet-stream): npm error code EACCES
npm error syscall mkdir
npm error path /var/hugo/.npm
npm error errno EACCES
npm error
npm error Your cache folder contains root-owned files, due to a bug in
npm error previous versions of npm which has since been addressed.
npm error
npm error To permanently fix this problem, please run:
npm error   sudo chown -R 1000:1000 "/var/hugo/.npm"
npm error Log files were not written due to an error writing to the directory: /var/hugo/.npm/_logs
npm error You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
Built in 826 ms
Error: error building site: render: failed to render pages: render of "page" failed: "/project/layouts/_default/tailwindcss.html:16:23": execute of template failed: template: _default/tailwindcss.html:16:23: executing "main" at <.Content>: error calling Content: TAILWINDCSS: failed to transform "/temp/css" (application/octet-stream): npm error code EACCES
npm error syscall mkdir
npm error path /var/hugo/.npm
npm error errno EACCES
npm error
npm error Your cache folder contains root-owned files, due to a bug in
npm error previous versions of npm which has since been addressed.
npm error
npm error To permanently fix this problem, please run:
npm error   sudo chown -R 1000:1000 "/var/hugo/.npm"
npm error Log files were not written due to an error writing to the directory: /var/hugo/.npm/_logs
npm error You can rerun the command with `--loglevel=verbose` to see the logs in your terminal

@dvdksn
Copy link
Contributor

dvdksn commented Oct 22, 2024

For the Linux case, where the directory is created automatically by -v host_path:ctr_path, this is expected if you're not running Docker Desktop.

The host_path dir is created by the daemon with root privileges. When you try to bind mount that directory into the container, its original permissions are retained. Because the Hugo container doesn't run as root, it doesn't have write access there. If you first create the directory with 755 permissions, the hugo:hugo container user can write to it.

On Docker Desktop, that is not an issue, because the directories are created wiht UID and GID mapping configured. So host_path is not owned by root.

The Windows issue I'm not sure about... I don't have a Windows machine that I can test with and I can't reproduce it otherwise. Are $Env:LocalAppData/hugo_cache and ./node_modules both nonexistent on host? Does it work if you remove the bind mount?

@jmooring
Copy link
Member Author

jmooring commented Oct 22, 2024

@dvdksn I ran these commands on Windows. On the host neither the cacheDir nor node_modules existed before running the test. Note that I removed the cache mount from the docker command.

git clone https://github.com/jmooring/hugo-docker-test
cd hugo-docker-test
docker run --rm -v .:/project  -p 1313:1313 ghcr.io/gohugoio/hugo:v0.136.2 server --bind="0.0.0.0"
log
Cloning into 'hugo-docker-test'...
remote: Enumerating objects: 206, done.
remote: Counting objects: 100% (206/206), done.
remote: Compressing objects: 100% (135/135), done.
Receiving objects:  99% (204/206), 12.72 MiB | 12.64 MiB/sreused 0 (from 0)
Receiving objects: 100% (206/206), 18.30 MiB | 13.18 MiB/s, done.
Resolving deltas: 100% (84/84), done.
PS C:\temp> cd hugo-docker-test
PS C:\temp\hugo-docker-test> docker run --rm -v .:/project -p 1313:1313 ghcr.io/gohugoio/hugo:latest server --bind="0.0.0.0"
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/nanoid/async/index.native.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/postcss/lib/list.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/postcss/lib/map-generator.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/nanoid/async/package.json'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/nanoid/non-secure/package.json'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.walk/out/readers/reader.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/postcss/lib/no-work-result.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/nanoid/url-alphabet/package.json'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.scandir/out/providers/sync.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/fast-glob/out/utils/errno.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/postcss/lib/node.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/fast-glob/out/providers/filters/error.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.walk/out/providers/stream.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/nanoid/async/index.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.stat/out/providers/async.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/postcss/lib/parse.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/fast-glob/out/utils/fs.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.walk/out/providers/sync.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.scandir/out/providers/async.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/postcss/lib/parser.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.walk/out/readers/sync.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/nanoid/non-secure/index.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.stat/out/index.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.scandir/out/providers/common.d.ts'
npm warn cleanup Failed to remove some directories [
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/color-convert',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/color-convert'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/color-convert'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/browserslist',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/browserslist'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/browserslist'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/electron-to-chromium',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/electron-to-chromium'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/electron-to-chromium'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/fraction.js',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/fraction.js'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/fraction.js'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/@parcel/watcher',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/@parcel/watcher'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/@parcel/watcher'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/braces',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/braces/lib'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/braces/lib'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/browserslist'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/browserslist'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/emoji-regex',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/emoji-regex/es2015'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/emoji-regex/es2015'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/dependency-graph',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/dependency-graph/lib'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/dependency-graph/lib'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/enhanced-resolve',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/enhanced-resolve/lib'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/enhanced-resolve/lib'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/fastq',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/fastq/test'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/fastq/test'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/nanoid',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/nanoid/non-secure'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/nanoid/non-secure'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/tapable',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/tapable/lib'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/tapable/lib'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/@tailwindcss/cli',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/@tailwindcss/cli'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/@tailwindcss/cli'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/@tailwindcss',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/@tailwindcss/cli'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/@tailwindcss/cli'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/@nodelib/fs.walk',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/@nodelib/fs.walk/out/providers'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/@nodelib/fs.walk/out/providers'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/@nodelib/fs.stat',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/@nodelib/fs.stat/out/providers'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/@nodelib/fs.stat/out/providers'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/fs-extra',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/fs-extra/lib'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/fs-extra/lib'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/cliui',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/cliui'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/cliui'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/@nodelib',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/@nodelib/fs.scandir/out/utils'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/@nodelib/fs.scandir/out/utils'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/fast-glob',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/fast-glob/out/providers'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/fast-glob/out/providers'
npm warn cleanup     }
npm warn cleanup   ],
npm warn cleanup   [
npm warn cleanup     '/project/node_modules/yaml',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/project/node_modules/yaml/browser/dist'] {
npm warn cleanup       errno: -39,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/project/node_modules/yaml/browser/dist'
npm warn cleanup     }
npm warn cleanup   ]
npm warn cleanup ]
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.stat/out/types/index.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/enhanced-resolve/lib/util/identifier.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/postcss/lib/postcss.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.stat/out/settings.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.stat/out/providers/sync.d.ts'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/postcss/lib/previous-map.js'
npm warn tar TAR_ENTRY_ERROR ENOENT: no such file or directory, open '/project/node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts'
npm error code EACCES
npm error syscall mkdir
npm error path /var/hugo/.npm
npm error errno -13
npm error
npm error Your cache folder contains root-owned files, due to a bug in
npm error previous versions of npm which has since been addressed.
npm error
npm error To permanently fix this problem, please run:
npm error   sudo chown -R 1000:1000 "/var/hugo/.npm"
npm error Log files were not written due to an error writing to the directory: /var/hugo/.npm/_logs
npm error You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
hugo: collected modules in 1178 ms
Watching for changes in /project/{archetypes,assets,content,layouts,package.json,postcss.config.js,static}
Watching for config changes in /project/config/_default, /project/go.mod
Start building sites …
hugo v0.136.2+extended linux/amd64 BuildDate=unknown VendorInfo=docker

ERROR render of "page" failed: "/project/layouts/_default/tailwindcss.html:16:23": execute of template failed: template: _default/tailwindcss.html:16:23: executing "main" at <.Content>: error calling Content: TAILWINDCSS: failed to transform "/temp/css" (application/octet-stream): npm error code EACCES
npm error syscall mkdir
npm error path /var/hugo/.npm
npm error errno EACCES
npm error
npm error Your cache folder contains root-owned files, due to a bug in
npm error previous versions of npm which has since been addressed.
npm error
npm error To permanently fix this problem, please run:
npm error   sudo chown -R 1000:1000 "/var/hugo/.npm"
npm error Log files were not written due to an error writing to the directory: /var/hugo/.npm/_logs
npm error You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
ERROR TAILWINDCSS: failed to transform "/temp/css" (application/octet-stream): npm error code EACCES
npm error syscall mkdir
npm error path /var/hugo/.npm
npm error errno EACCES
npm error
npm error Your cache folder contains root-owned files, due to a bug in
npm error previous versions of npm which has since been addressed.
npm error
npm error To permanently fix this problem, please run:
npm error   sudo chown -R 1000:1000 "/var/hugo/.npm"
npm error Log files were not written due to an error writing to the directory: /var/hugo/.npm/_logs
npm error You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
ERROR POSTCSS: failed to transform "/temp/css" (application/octet-stream): npm error code EACCES
npm error syscall mkdir
npm error path /var/hugo/.npm
npm error errno EACCES
npm error
npm error Your cache folder contains root-owned files, due to a bug in
npm error previous versions of npm which has since been addressed.
npm error
npm error To permanently fix this problem, please run:
npm error   sudo chown -R 1000:1000 "/var/hugo/.npm"
npm error Log files were not written due to an error writing to the directory: /var/hugo/.npm/_logs
npm error You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
Built in 825 ms
Error: error building site: render: failed to render pages: render of "page" failed: "/project/layouts/_default/postcss.html:20:23": execute of template failed: template: _default/postcss.html:20:23: executing "main" at <.Content>: error calling Content: POSTCSS: failed to transform "/temp/css" (application/octet-stream): npm error code EACCES
npm error syscall mkdir
npm error path /var/hugo/.npm
npm error errno EACCES
npm error
npm error Your cache folder contains root-owned files, due to a bug in
npm error previous versions of npm which has since been addressed.
npm error
npm error To permanently fix this problem, please run:
npm error   sudo chown -R 1000:1000 "/var/hugo/.npm"
npm error Log files were not written due to an error writing to the directory: /var/hugo/.npm/_logs
npm error You can rerun the command with `--loglevel=verbose` to see the logs in your terminal

@jmooring
Copy link
Member Author

The Windows test started passing again, and I'm not sure what changed.

@jmooring jmooring marked this pull request as draft November 4, 2024 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document usage of the ghcr.io/gohugoio/hugo Docker image
3 participants