rstudio / bookdown

Authoring Books and Technical Documents with R Markdown
https://pkgs.rstudio.com/bookdown/
GNU General Public License v3.0
3.78k stars 1.27k forks source link

Site deployment failed with error: exit status 1 #800

Closed qiushiyan closed 4 years ago

qiushiyan commented 4 years ago

I was trying to publish a bookdown project to https://bookdown.org/, and encoutered this error:

Preparing to deploy site...DONE
Uploading bundle for site: 3223...DONE
Deploying bundle: 13576 for site: 3223 ...
Building R Markdown document...
Bundle requested R version 3.6.1; using /opt/R/3.4.0/bin/R which has version 3.4.0
2019/11/04 16:05:25.957491641 Error in load(name, envir = .GlobalEnv) : 
2019/11/04 16:05:25.957573487   bad restore file magic number (file may be corrupted) -- no data loaded
2019/11/04 16:05:25.957629305 Calls: sys.load.image -> load
2019/11/04 16:05:25.957632388 In addition: Warning message:
2019/11/04 16:05:25.957643262 file ‘.RData’ has magic number 'RDX3'
2019/11/04 16:05:25.957645268   Use of save versions prior to 2 is deprecated 
2019/11/04 16:05:25.957656309 Execution halted
Build error: exit status 1
Site deployment failed with error: exit status 1
Deployment completed: https://bookdown.org/connect/#/apps/3223/logs

I tried to search for /opt/R/3.4.0/bin/R in my computer and found nothing. My sessioninfo is:

> sessionInfo()
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)

Matrix products: default

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

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

other attached packages:
 [1] wordcloud2_0.2.1  janeaustenr_0.1.5 forcats_0.4.0     stringr_1.4.0     dplyr_0.8.3      
 [6] purrr_0.3.3       readr_1.3.1       tidyr_1.0.0       tibble_2.1.3      ggplot2_3.2.1    
[11] tidyverse_1.2.1   tidytext_0.2.2   

loaded via a namespace (and not attached):
 [1] httr_1.4.1         jsonlite_1.6       modelr_0.1.5       StanHeaders_2.19.0 assertthat_0.2.1  
 [6] askpass_1.1        stats4_3.6.1       cellranger_1.1.0   yaml_2.2.0         pillar_1.4.2      
[11] backports_1.1.5    lattice_0.20-38    glue_1.3.1         textdata_0.3.0     digest_0.6.21     
[16] rvest_0.3.4        colorspace_1.4-1   htmltools_0.4.0    Matrix_1.2-17      pkgconfig_2.0.3   
[21] rstan_2.19.2       broom_0.5.2        haven_2.1.1        bookdown_0.14      scales_1.0.0      
[26] processx_3.4.1     openssl_1.4.1      generics_0.0.2     ellipsis_0.3.0     withr_2.1.2       
[31] lazyeval_0.2.2     cli_1.1.0          magrittr_1.5       crayon_1.3.4       readxl_1.3.1      
[36] evaluate_0.14      ps_1.3.0           stopwords_1.0      tokenizers_0.2.1   fs_1.3.1          
[41] fansi_0.4.0        nlme_3.1-140       SnowballC_0.6.0    xml2_1.2.2         pkgbuild_1.0.6    
[46] rsconnect_0.8.15   tools_3.6.1        loo_2.1.0          prettyunits_1.0.2  hms_0.5.2         
[51] lifecycle_0.1.0    matrixStats_0.55.0 munsell_0.5.0      callr_3.3.2        packrat_0.5.0     
[56] compiler_3.6.1     rlang_0.4.1        grid_3.6.1         rstudioapi_0.10    htmlwidgets_1.5.1 
[61] rappdirs_0.3.1     labeling_0.3       rmarkdown_1.16     gtable_0.3.0       curl_4.2          
[66] inline_0.3.15      R6_2.4.0           gridExtra_2.3      lubridate_1.7.4    knitr_1.25        
[71] utf8_1.1.4         zeallot_0.1.0      stringi_1.4.3      parallel_3.6.1     Rcpp_1.0.2        
[76] vctrs_0.2.0        tidyselect_0.2.5   xfun_0.10         
qiushiyan commented 4 years ago
> xfun::session_info('bookdown')
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362), RStudio 1.2.5001

Locale:
  LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252   
  LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C                           
  LC_TIME=English_United Kingdom.1252    

Package version:
  base64enc_0.1.3 bookdown_0.14   digest_0.6.21   evaluate_0.14   glue_1.3.1      graphics_3.6.1 
  grDevices_3.6.1 highr_0.8       htmltools_0.4.0 jsonlite_1.6    knitr_1.25      magrittr_1.5   
  markdown_1.1    methods_3.6.1   mime_0.7        Rcpp_1.0.2      rlang_0.4.1     rmarkdown_1.16 
  stats_3.6.1     stringi_1.4.3   stringr_1.4.0   tinytex_0.17    tools_3.6.1     utils_3.6.1    
  xfun_0.10       yaml_2.2.0  
cderv commented 4 years ago

Thanks for the report.

How did you try to publish you book ? Did you follow the documentation https://bookdown.org/home/about/ ?

bookdown::publish_book(render = 'local')

I ask because when publishing a content to bookdow.org, no Rmarkdown file should be run on the servers, and so no R version should be required. Bookdown should be build locally on your computer then the resulting gitbook output should be published.

About the error you encounter

Only R upto 3.4.0 is available on bookdown.org RStudio connect. When deploying a content that requires R to run the document, a match is done between your version of R locally, and one on the servers. The closest is used. (Reminder: this should not happened when publishing to bookdown.org)

However, there are changes in R 3.6.0 that are not retro compatible. Specifically with serialization format. See https://stat.ethz.ch/pipermail/r-announce/2019/000641.html

extract of CHANGES IN R 3.6.0: > CHANGES IN R 3.6.0: > SIGNIFICANT USER-VISIBLE CHANGES: > * Serialization format version 3 becomes the default for serialization and saving of the workspace (save(), serialize(), saveRDS(), compiler::cmpfile()). Serialized data in format 3 cannot be read by versions of R prior to version 3.5.0. Serialization format version 2 is still supported and can be selected by version = 2 in the save/serialization functions. The default can be changed back for the whole R session by setting environment variables R_DEFAULT_SAVE_VERSION and R_DEFAULT_SERIALIZE_VERSION to 2. For maximal back-compatibility, files vignette.rds and partial.rdb generated by R CMD build are in serialization format version 2, and resave by default produces files in serialization format version 2 (unless the original is already in format version 3).

That means code that runs locally on R 3.6.1 should not work by default on bookdown.org because not compatible with R 3.4.0. To make the code compatible, specifically R objects savec that should be loaded again, the default should be changed.

I tell you this so thta you understand the issue, but I don't think this is normal that R code are run on the bookdow.org server.

Try to publish using bookdown::publish_book(render = 'local') by following the doc

qiushiyan commented 4 years ago

I see, now it worked. Great help!

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.