首页 > 解决方案 > 与 YAML 序列化程序相关的 pkgdown build_site() 出错

问题描述

当我运行时pkgdown::build_site(),我收到以下错误:

Error in .Call(C_serialize_to_yaml, x, line.sep, indent, omap, column.major,  : 
  Incorrect number of arguments (9), expecting 8 for 'serialize_to_yaml'
Calls: withCallingHandlers ... <Anonymous> -> <Anonymous> -> .handleSimpleError -> h
Execution halted
Error in .Call(C_serialize_to_yaml, x, line.sep, indent, omap, column.major,  : 
  Incorrect number of arguments (9), expecting 8 for 'serialize_to_yaml'

顺着函数链,我发现问题似乎是在调用时触发的yaml::as.yaml(meta)。这是一种无需整个软件包即可重现错误的快速方法(请注意,这meta是由 pkgdown 以这种形式创建的):

meta <- list(
     pandoc = "2.2.2.1",
     pkgdown = "1.1.0",
     pkgdown_sha = NULL,
     articles = list(
         intermediate = "intermediate.html",
         introduction = "introduction.html")
)
yaml::as.yaml(meta)

这是我的会话信息,以防万一:

R version 3.5.1 (2018-07-02)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

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] yaml_2.2.0    pkgdown_1.1.0

loaded via a namespace (and not attached):
 [1] roxygen2_6.1.0   Rcpp_0.12.18     digest_0.6.15    crayon_1.3.4     rprojroot_1.3-2 
 [6] assertthat_0.2.0 commonmark_1.5   MASS_7.3-50      R6_2.2.2         backports_1.1.2 
[11] magrittr_1.5     stringi_1.2.4    rlang_0.2.1      rstudioapi_0.7   fs_1.2.4        
[16] xml2_1.2.0       desc_1.2.0       tools_3.5.1      stringr_1.3.1    compiler_3.5.1  
[21] memoise_1.1.0   

标签: ryamlpkgdown

解决方案


删除并重新安装 yaml 包解决了这个问题。


推荐阅读