rstudio / blogdown

Create Blogs and Websites with R Markdown
https://pkgs.rstudio.com/blogdown/
1.73k stars 334 forks source link

[FR] informative message for missing Hugo #764

Closed setgree closed 3 months ago

setgree commented 3 months ago

I have a blog that I write in Rmarkdown and maintain on GitHub. I recently bought a new computer. I had my coding folder with my blog contents on Dropbox and automatically synced it to my new computer. I reinstalled all the packages that I could remember. Today I tried to serve_site using the menu-based addin, and got:

> blogdown:::serve_site()
Error in attr(config, "config_time") <- m : 
  attempt to set an attribute on NULL

This was not informative. I googled it, and nothing useful came up. However, then I remembered that I probably needed to install hugo, and that did the trick:

> blogdown::install_hugo()
The latest Hugo version is v0.128.2
trying URL 'https://github.com/gohugoio/hugo/releases/download/v0.128.2/hugo_extended_0.128.2_darwin-universal.tar.gz'
Content type 'application/octet-stream' length 43569496 bytes (41.6 MB)
==================================================
downloaded 41.6 MB

Hugo has been installed to "/Users/user/Library/Application Support/Hugo/0.128.2". You are recommended to set options(blogdown.hugo.version = "0.128.2") in the .Rprofile file in your website project. See the blogdown book for more info on .Rprofile: https://bookdown.org/yihui/blogdown/global-options.html

> blogdown:::serve_site()
Launching the server via the command:
  /Users/user/Library/Application Support/Hugo/0.128.2/hugo server --bind 127.0.0.1 -p 4321 --themesDir themes --theme hugo-lithium -D -F --navigateToChanged
Serving the directory . at http://localhost:4321
Launched the hugo server in the background (process ID: 3434). To stop it, call blogdown::stop_server() or restart the R session.

Maybe the error message can be amended to point future n00bs like myself in the right direction?

Thank you!

yihui commented 3 months ago

Thanks for the report! When I delete Hugo on my computer, clone your repo, and run Serve Site, I get this error message:

> blogdown:::serve_site()
Error: hugo 0.128.2 not found. You may try blogdown::install_hugo("0.128.2").

I'm not sure how to reproduce the error message you encountered...

setgree commented 3 months ago

interesting, perhaps it's something more idiosyncratic about my setup. My instinct is that it was because I did not clone everything, but instead synced it via Dropbox. (this was the source of some different headaches.) Thanks for investigating, I think we can probably close the issue in that case.

On Tue, Jul 16, 2024 at 4:31 PM Yihui Xie @.***> wrote:

Thanks for the report! When I delete Hugo on my computer, clone your repo, and run Serve Site, I get this error message:

blogdown:::serve_site()Error: hugo 0.128.2 not found. You may try blogdown::install_hugo("0.128.2").

I'm not sure how to reproduce the error message you encountered...

— Reply to this email directly, view it on GitHub https://github.com/rstudio/blogdown/issues/764#issuecomment-2231776620, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACLE3UV3IWE5Q6343DBJFVDZMV7KZAVCNFSM6AAAAABK4YCRU6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZRG43TMNRSGA . You are receiving this because you authored the thread.Message ID: @.***>

-- Seth Green

yihui commented 3 months ago

Okay, I can investigate again if someone else runs into this problem in the future. The original error message you mentioned was definitely not informative.