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

variant: avoid Hugo permission errors on build #831

Closed
kamar535 opened this issue Apr 17, 2024 · 7 comments
Closed

variant: avoid Hugo permission errors on build #831

kamar535 opened this issue Apr 17, 2024 · 7 comments
Assignees
Labels
breaking Introduces breaking changes with existing installations bug Something isn't working
Milestone

Comments

@kamar535
Copy link

I've used the excellent Relearn theme before but now, I can only run hugo --renderToMemory server. Running hugo or hugo server fails due to permission denied errors.

Details and discussion here:

@kamar535
Copy link
Author

And here’s a failing minimal example as provided by jmooring in the the Hugo forums:

git clone --single-branch -b hugo-forum-topic-49335 https://github.com/jmooring/hugo-testing hugo-forum-topic-49335
cd hugo-forum-topic-49335
hugo server

This fails with:

ERROR Failed to publish Resource: open /home/jmooring/code/hugo-testing/public/css/theme-relearn-light.css: permission denied
ERROR Failed to publish Resource: open /home/jmooring/code/hugo-testing/public/css/theme-relearn-dark.css: permission denied

More from jmooring:

If I vendor the module it works fine:

hugo mod vendor
hugo

This is just a clue as to what the problem might be. I am not recommending that you do this. You’d have to undo it to update the theme in the future (though undoing it just a matter of deleting the _vendor directory in the root of the project).

@jmooring
Copy link

jmooring commented Apr 17, 2024

See also:

Perhaps you can change the default behavior so that new users have a better experience.

@McShelby
Copy link
Owner

After three issues here, I can say that it's worth a change.

I had my reasons to do it this way, initially but it's not worth the resulting hassle for the users.

@McShelby McShelby self-assigned this Apr 17, 2024
@McShelby McShelby added bug Something isn't working change Introduces changes with existing installations labels Apr 17, 2024
@McShelby McShelby added this to the 5.27.1 milestone Apr 17, 2024
@kamar535
Copy link
Author

After reading the issues linked by @jmooring I've now tried:

  1. Running hugo --noChmod but I still get the same permission errors.
  2. But, setting themeVariantModifier = ".gen" in the [params] section in hugo.toml as described in the theme Configuration section of the theme Relearn documentation worked fine. I'm happy this workaround exists but at the same time appreciate that the root cause will be fixed in the next release of the Relearn theme.

@McShelby McShelby added breaking Introduces breaking changes with existing installations and removed change Introduces changes with existing installations labels Apr 18, 2024
@McShelby McShelby modified the milestones: 5.28.0, 6.0.0 Apr 18, 2024
@McShelby
Copy link
Owner

Just as an information: Fixing this will introduce a breaking change and will lead into a major release (in terms of semver).

Because I want to put some other breaking changes into this release, it will take a few days to wrap this up.

@McShelby McShelby changed the title Can only run Hugo with –renderToMemory otherwise gets permission denied errors even after chmod a+rwx variant: avoid Hugo permission errors on build Apr 18, 2024
McShelby added a commit that referenced this issue Apr 19, 2024
@McShelby
Copy link
Owner

I've pushed to main,

@kamar535 Could you give it another try? Some other stuff changed, may requiring additional changes by you: https://mcshelby.github.io/hugo-theme-relearn/basics/migration/index.html#600

@McShelby
Copy link
Owner

I checked with the latest head of the theme and jmoorings example by modifying the commands to

git clone --single-branch -b hugo-forum-topic-49335 https://github.com/jmooring/hugo-testing hugo-forum-topic-49335
cd hugo-forum-topic-49335
hugo mod get -u
hugo server

As this now works without any issues, I hope it's resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Introduces breaking changes with existing installations bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants