rstudio / blogdown

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

Issues with serve_site #292

Closed chris-prener closed 6 years ago

chris-prener commented 6 years ago

Hey @yihui - thanks so much for such a fantastic package - I've been using it for a number of different sites and really love how it works.

However, I've started having some issues with both the CRAN and development versions of blogdown on a site. I've noticed that serve_site() no longer produces output in my console:

> library(blogdown)
> serve_site()
Warning: You are recommended to ignore certain files in config.toml: set the option ignoreFiles = ["\\.Rmd$", "\\.Rmarkdown$", "_files$", "_cache$"]
> 

If I run blogdown through a terminal, however, I get the expected updates each time the LiveReload occurs:

Christophers-MacBook-Air:slu-soc5650.github.io chris$ R

R version 3.5.0 (2018-04-23) -- "Joy in Playing"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> blogdown::serve_site()
Warning: You are recommended to ignore certain files in config.toml: set the option ignoreFiles = ["\\.Rmd$", "\\.Rmarkdown$", "_files$", "_cache$"]

                   | EN
+------------------+----+
  Pages            | 51
  Paginator pages  |  0
  Non-page files   |  0
  Static files     | 52
  Processed images |  0
  Aliases          |  0
  Sitemaps         |  1
  Cleaned          |  0

Total in 54 ms
Serving the directory /Users/chris/GitHub/SOC5650/CoreRepos/slu-soc5650.github.io at http://127.0.0.1:4321
To stop the server, run servr::daemon_stop("140706056278088") or restart your R session

                   | EN
+------------------+----+
  Pages            | 51
  Paginator pages  |  0
  Non-page files   |  0
  Static files     | 52
  Processed images |  0
  Aliases          |  0
  Sitemaps         |  1
  Cleaned          |  0

Total in 52 ms

This issue is consistent across multiple different blogdown sites.

Beyond this inconsistency, serve_site() no longer seems to be processing updated files. If I make a small change, like adding a word to any page other than the main index.md file for my site, the change will not be rendered and I can't see it on the preview version in the Viewer tab or by opening up the preview version of the site in my browser. The same goes for build_site().

This was all working as recently as three days ago, when I last updated the site in question. When I first ran into these issues and couldn't solve them, I updated my version of R to 3v.5 (I had been on v3.4.3) and updated to the latest release for RStudio v1.1.447. These updates did not help, nor did changing from the CRAN release version of blogdown to the development version. Other blogdown sites that I have to not appear to have this specific problem, but I don't get any error messages in either the console or the terminal when I go to serve the site.

Here is my session info:

> devtools::session_info('blogdown')
Session info ---------------------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.5.0 (2018-04-23)
 system   x86_64, darwin15.6.0        
 ui       RStudio (1.1.447)           
 language (EN)                        
 collate  en_US.UTF-8                 
 tz       America/Chicago             
 date     2018-05-06                  

Packages -------------------------------------------------------------------------------------------------------------
 package   * version  date       source        
 backports   1.1.2    2017-12-13 CRAN (R 3.5.0)
 base64enc   0.1-3    2015-07-28 CRAN (R 3.5.0)
 BH          1.66.0-1 2018-02-13 CRAN (R 3.5.0)
 blogdown  * 0.6      2018-04-18 CRAN (R 3.5.0)
 bookdown    0.7      2018-02-18 CRAN (R 3.5.0)
 digest      0.6.15   2018-01-28 CRAN (R 3.5.0)
 evaluate    0.10.1   2017-06-24 CRAN (R 3.5.0)
 glue        1.2.0    2017-10-29 CRAN (R 3.5.0)
 graphics  * 3.5.0    2018-04-24 local         
 grDevices * 3.5.0    2018-04-24 local         
 highr       0.6      2016-05-09 CRAN (R 3.5.0)
 htmltools   0.3.6    2017-04-28 CRAN (R 3.5.0)
 httpuv      1.4.2    2018-05-03 CRAN (R 3.5.0)
 jsonlite    1.5      2017-06-01 CRAN (R 3.5.0)
 knitr       1.20     2018-02-20 CRAN (R 3.5.0)
 later       0.7.2    2018-05-01 CRAN (R 3.5.0)
 magrittr    1.5      2014-11-22 CRAN (R 3.5.0)
 markdown    0.8      2017-04-20 CRAN (R 3.5.0)
 methods   * 3.5.0    2018-04-24 local         
 mime        0.5      2016-07-07 CRAN (R 3.5.0)
 promises    1.0.1    2018-04-13 CRAN (R 3.5.0)
 R6          2.2.2    2017-06-17 CRAN (R 3.5.0)
 Rcpp        0.12.16  2018-03-13 CRAN (R 3.5.0)
 rlang       0.2.0    2018-02-20 CRAN (R 3.5.0)
 rmarkdown   1.9      2018-03-01 CRAN (R 3.5.0)
 rprojroot   1.3-2    2018-01-03 CRAN (R 3.5.0)
 servr       0.9      2018-03-25 CRAN (R 3.5.0)
 stats     * 3.5.0    2018-04-24 local         
 stringi     1.2.2    2018-05-02 CRAN (R 3.5.0)
 stringr     1.3.0    2018-02-19 CRAN (R 3.5.0)
 tinytex     0.5      2018-04-16 CRAN (R 3.5.0)
 tools       3.5.0    2018-04-24 local         
 utils     * 3.5.0    2018-04-24 local         
 xfun        0.1      2018-01-22 CRAN (R 3.5.0)
 yaml        2.1.19   2018-05-01 CRAN (R 3.5.0)

Thanks for your help attempting to locate what is happening here!

yihui commented 6 years ago

Let's try to solve these issues one by one. The first one should be easy. The warning message about config.toml means you need to do what the message tells you to do.

chris-prener commented 6 years ago

thanks @yihui - really appreciate your response. That is fixed now - no longer getting the warning. I checked the serve_site() issue and it persists (not sure if its related to the first or not?). Thanks for your help!

yihui commented 6 years ago

Does the development version of servr help?

# restart R, and
devtools::install_github('yihui/servr')
chris-prener commented 6 years ago

it doesn't, unfortunately... the only pattern I can identify here is that it is related to pages stored in subdirectories of content/. I have a couple of different blogdown sites and the lack of output from serve_site() is consistent across all of them. But the sites that use subdirectories for different pages are where I am no longer seeing changes to the .md registered in the .html. Thanks again for trying to help - these are sites for my courses and I'd love to get them up and running again!

yihui commented 6 years ago

The reason that serve_site() no longer gives output in the console is because RStudio 1.1.447 has a bug about ANSI Escape Codes. You can either apply the fix here: https://github.com/rstudio/rstudio/issues/2248#issuecomment-371373135, or test RStudio daily: https://dailies.rstudio.com.

I guess the reason LiveReload no longer works is because you updated Hugo. Previously you were using Hugo 0.30:

https://github.com/slu-soc5650/slu-soc5650.github.io/blob/675e928233382ffbfb48c3148ed5eb1650cec6b1/public/course-preview/index.html#L13

Now you upgraded to 0.40.2:

https://github.com/slu-soc5650/slu-soc5650.github.io/blob/675e928233382ffbfb48c3148ed5eb1650cec6b1/public/index.html#L13

I don't have time to check what exactly the change it was that caused the breakage (way too many changes between these two versions: https://github.com/gohugoio/hugo/releases), but a quick way to revert to the previous version of Hugo:

blogdown::install_hugo('0.30', force = T, use_brew = F)

I guess you installed Hugo via Homebrew, so you may also uninstall it (no need to keep two versions):

system('brew remove hugo')

Remember to restart R after installing/uninstalling Hugo.

You can also use different versions of Hugo for different websites; see the blogdown.hugo.dir option at https://bookdown.org/yihui/blogdown/more-global-options.html (you can set it per project).

chris-prener commented 6 years ago

thanks @yihui - the life preserver here much appreciated. I'm happy to run on the older version of hugo so long as I can keep maintaining my sites!

yihui commented 6 years ago

Excellent! It is a huge advantage of Hugo that you can easily use a specific version of Hugo because it is just a single small standalone binary.

BTW, the course website looks gorgeous! I really like it.

chris-prener commented 6 years ago

Thanks @yihui - the site is a work in the progress but I'm really happy with how it is coming together!

chris-prener commented 6 years ago

hey @yihui - quick update - I had to deal with some Hugo related issues on a different site and discovered that the issues I had with Hugo v0.40.2 have been fixed in v0.40.3.

yihui commented 6 years ago

Very glad to hear that! Thanks for posting back!