yihui / knitr

A general-purpose tool for dynamic report generation in R
https://yihui.org/knitr/
2.38k stars 873 forks source link

Error with `blogdown` `build_site`/`serve_site` using `knitr-1.17`. But `knitr-1.16` works #1422

Closed fortunewalla closed 7 years ago

fortunewalla commented 7 years ago

Summary: Possible knitr-1.17 gives blogdown build_site/serve_site error. But knitr-1.16 works Tested: Using both knitr-1.17 and reverting to older version knitr-1.16 Environment: RStudio in both windows 10 x64 and Ubuntu 16 x64

  1. Updated knitr from 1.16 to 1.17 within RStudio
  2. Tried to Build Site project in Windows 10 x64
==> rmarkdown::render_site(encoding = 'UTF-8')

Error in grep(knitr::all_patterns$md$inline.code, yaml) : 
  invalid regular expression '(?<!(^|
)``)`r[ #]([^`]+)\s*`', reason 'Invalid regexp'
Calls: <Anonymous> ... in_dir -> writeUTF8 -> writeLines -> fetch_yaml2 -> grep
Execution halted

Exited with status 1.
  1. Tried to serve_site() on Windows 10
> blogdown:::serve_site()
Error in grep(knitr::all_patterns$md$inline.code, yaml) : 
  invalid regular expression '(?<!(^|
)``)`r[ #]([^`]+)\s*`', reason 'Invalid regexp'
  1. Tried to build site on Ubuntu 16
==> rmarkdown::render_site(encoding = 'UTF-8')

Error in grep(knitr::all_patterns$md$inline.code, yaml) : 
  invalid regular expression '(?<!(^|
)``)`r[ #]([^`]+)\s*`', reason 'Invalid regexp'
Calls: <Anonymous> ... in_dir -> writeUTF8 -> writeLines -> fetch_yaml2 -> grep
Execution halted

Exited with status 1.
  1. Tried to serve_site() on Ubuntu 16

    blogdown:::serve_site()
    Error in if (local && !require_rebuild(html, f)) next : 
    missing value where TRUE/FALSE needed
    > 
  2. Removed knitr-1.17 and installed knitr-1.16 through 'install.version`

Windows10

> remove.packages("knitr", lib="~/R/win-library/3.3")
> library(devtools)
Warning messages:
1: In read.dcf(file.path(p, "DESCRIPTION"), c("Package", "Version")) :
  cannot open compressed file 'C:/Users/UserName/Documents/R/win-library/3.3/knitr/DESCRIPTION', probable reason 'No such file or directory'
2: In read.dcf(file.path(p, "DESCRIPTION"), c("Package", "Version")) :
  cannot open compressed file 'C:/Users/UserName/Documents/R/win-library/3.3/knitr/DESCRIPTION', probable reason 'No such file or directory'
3: In find.package(if (is.null(package)) loadedNamespaces() else package,  :
  there is no package called ‘knitr’
> install_version("knitr",version = 1.16)
Trying https://cran.rstudio.com/
Trying http://www.stats.ox.ac.uk/pub/RWin
Downloading package from url: https://cran.rstudio.com//src/contrib/Archive/knitr/knitr_1.16.tar.gz
Installing knitr
"C:/PROGRA~1/R/R-33~1.3/bin/x64/R" --no-site-file --no-environ --no-save  \
  --no-restore --quiet CMD INSTALL  \
  "C:/Users/UserName/AppData/Local/Temp/Rtmpc9IOpi/devtools2d80451b357b/knitr"  \
  --library="C:/Users/UserName/Documents/R/win-library/3.3" --install-tests 

* installing *source* package 'knitr' ...
** package 'knitr' successfully unpacked and MD5 sums checked
** R
** demo
** inst
** tests
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
*** arch - i386
*** arch - x64
* DONE (knitr)

Ubuntu16

> remove.packages("knitr", lib="~/R/x86_64-pc-linux-gnu-library/3.4")
> library(devtools)
Warning message:
In read.dcf(file.path(p, "DESCRIPTION"), c("Package", "Version")) :
  cannot open compressed file '/home/linux/R/x86_64-pc-linux-gnu-library/3.4/knitr/DESCRIPTION', probable reason 'No such file or directory'
> install_version("knitr",version = 1.16)
Downloading package from url: https://cran.rstudio.com//src/contrib/Archive/knitr/knitr_1.16.tar.gz
Installing knitr
'/usr/lib/R/bin/R' --no-site-file --no-environ --no-save --no-restore --quiet CMD INSTALL  \
  '/tmp/RtmpifWSWp/devtools8302948b274/knitr' --library='/home/linux/R/x86_64-pc-linux-gnu-library/3.4'  \
  --install-tests 

* installing *source* package ‘knitr’ ...
** package ‘knitr’ successfully unpacked and MD5 sums checked
** R
** demo
** inst
** tests
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (knitr)
  1. Now build_site() serve_site() works.
==> rmarkdown::render_site(encoding = 'UTF-8')

Started building sites ...
Built site for language en:
0 draft content
0 future content
0 expired content
4 regular pages created
30 other pages created
0 non-page files copied
0 paginator pages created
8 tags created
3 categories created
total in 522 ms

Output created: public/index.html

--------------------------------------

> blogdown:::serve_site()
Started building sites ...
Built site for language en:
0 draft content
0 future content
0 expired content
4 regular pages created
30 other pages created
0 non-page files copied
0 paginator pages created
8 tags created
3 categories created
total in 299 ms
Serving the directory C:\Users\UserName\hugo-xmin-test at http://127.0.0.1:4321

Ubuntu16

> blogdown::serve_site()
Started building sites ...
Built site for language en:
0 draft content
0 future content
0 expired content
5 regular pages created
18 other pages created
0 non-page files copied
0 paginator pages created
3 tags created
2 categories created
total in 44 ms
Serving the directory /home/linux/fwblog at http://127.0.0.1:4321
  1. Information about Session
> sessionInfo()
R version 3.3.3 (2017-03-06)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] devtools_1.13.3 shiny_1.0.3    

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.12     rstudioapi_0.6   servr_0.6        knitr_1.16      
 [5] bindr_0.1        magrittr_1.5     xtable_1.8-2     R6_2.2.2        
 [9] rlang_0.1.2      highr_0.6        httr_1.2.1       stringr_1.2.0   
[13] dplyr_0.7.2      tools_3.3.3      miniUI_0.1.1     withr_2.0.0     
[17] htmltools_0.3.6  yaml_2.1.14      rprojroot_1.2    digest_0.6.12   
[21] assertthat_0.2.0 tibble_1.3.3     bookdown_0.4     bindrcpp_0.2    
[25] curl_2.8.1       memoise_1.1.0    mime_0.5         glue_1.1.1      
[29] evaluate_0.10.1  rmarkdown_1.6    blogdown_0.0.42  stringi_1.1.5   
[33] backports_1.1.0  gitgadget_0.2.1  jsonlite_1.5     httpuv_1.3.5    
[37] pkgconfig_2.0.1

Ubuntu16

> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.3 LTS

Matrix products: default
BLAS: /usr/lib/atlas-base/atlas/libblas.so.3.0
LAPACK: /usr/lib/atlas-base/atlas/liblapack.so.3.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] devtools_1.13.3

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.12    bookdown_0.4    withr_2.0.0     digest_0.6.12   rprojroot_1.2   mime_0.5        R6_2.2.2       
 [8] backports_1.1.0 magrittr_1.5    evaluate_0.10.1 highr_0.6       httr_1.2.1      blogdown_0.0.41 stringi_1.1.5  
[15] curl_2.8.1      rmarkdown_1.6   tools_3.4.1     servr_0.6       stringr_1.2.0   httpuv_1.3.5    yaml_2.1.14    
[22] compiler_3.4.1  memoise_1.1.0   htmltools_0.3.6 knitr_1.16   
yihui commented 7 years ago

Please reinstall blogdown.

fortunewalla commented 7 years ago

Updated blogdown to 0.0.64. Now works with knitr-1.17 Thanks.

github-actions[bot] commented 3 years ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.