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

hugo module cache error preventing site from building locally #1048

Closed
olizilla opened this issue Aug 6, 2020 · 1 comment · Fixed by #1089
Closed

hugo module cache error preventing site from building locally #1048

olizilla opened this issue Aug 6, 2020 · 1 comment · Fixed by #1089
Labels
hint: beta Hint: Issues related to the beta branch

Comments

@olizilla
Copy link
Collaborator

olizilla commented Aug 6, 2020

About every other week, I am hitting an issue where the sites fails to build locally, failing with an error about missing modules.

⨎ npm run serve

> specs-new@1.0.0 serve /Users/oli/Code/filecoin-project/specs
> hugo server --bind=0.0.0.0

go: github.com/filecoin-project/specs-actors@v0.8.6: reading github.com/filecoin-project/specs-actors/go.mod at revision v0.8.6: unknown revision v0.8.6
hugo: collected modules in 768 ms
Error: failed to download modules: go command failed: go: github.com/filecoin-project/specs-actors@v0.8.6: reading github.com/filecoin-project/specs-actors/go.mod at revision v0.8.6: unknown revision v0.8.6

The fix

hugo & macos can't play nice with their tmp dir. you have to delete it all and start again.

npx hugo mod clean --all

This will wipe the hugo module cache, so it can be downloaded fresh next time you run a hugo command (or npm run serve)... you need the --all flag in there or else it seems that the clean command (as with all the others) fails when it encounters the broken module.


The hugo author notes that this should be more promenant in the docs... no kidding.

A related hint from me (which should get a more prominent place in the docs):

  • Hugo uses a /tmp dir for the cache if cace dir is not set (in config.toml or environment)
  • Go downloads the modules and write protects all directories
  • On MacOS I have experienced some occasional issues which I guess relates to MacOS trying to clean out these directories, but only partly succeeds.
  • Setting HUGO_CACHEDIR os env variable to something outside /tmp is the solution to the above. It’s also in general a good thing.

see: https://discourse.gohugo.io/t/hugo-modules-for-dummies/20758/8

I dont see how manually managing your cache dir is a good thing, but i've wasted enough time on this now, and passing the --all flag seems to fix it without having to pick a custom tmp dir that works on all OSs /rant

@olizilla olizilla added this to To do in beta.spec.filecoin.io via automation Aug 6, 2020
@olizilla olizilla mentioned this issue Aug 6, 2020
10 tasks
@yiannisbot
Copy link
Collaborator

@olizilla that's very useful! I think it should be in the main README, as people will likely not search through issues to troubleshoot their local build.

@hugomrdias hugomrdias added the hint: beta Hint: Issues related to the beta branch label Aug 18, 2020
olizilla added a commit that referenced this issue Aug 25, 2020
fixes #1048

License: MIT
Signed-off-by: Oli Evans <oli@tableflip.io>
@olizilla olizilla moved this from To do to In progress in beta.spec.filecoin.io Aug 25, 2020
beta.spec.filecoin.io automation moved this from In progress to Done Aug 25, 2020
hugomrdias pushed a commit that referenced this issue Aug 25, 2020
fixes #1048

License: MIT
Signed-off-by: Oli Evans <oli@tableflip.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hint: beta Hint: Issues related to the beta branch
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

3 participants