【问题标题】:Error in using blogdown new_stite() function使用 blogdown new_stite() 函数时出错
【发布时间】:2017-11-02 16:59:28
【问题描述】:

我是 E blogdown 包的新手。我有 rad 第一章的 bogdown 书。我尝试使用以下方法制作新网站:

new_site(dir = "E:/data/R/EconStats", install_hugo = TRUE, format = "toml", 
+          sample = TRUE, theme = "yihui/hugo-xmin", theme_example = TRUE, 
+          serve = interactive())

但它返回一个错误:

Congratulations! Your new Hugo site is created in E:\data\R\EconStats.

Just a few more steps and you're ready to go:

1. Download a theme into the same-named folder.
   Choose a theme from https://themes.gohugo.io/, or
   create your own with the "hugo new theme <THEMENAME>" command.
2. Perhaps you want to add some content. You can add single files
   with "hugo new <SECTIONNAME>\<FILENAME>.<FORMAT>".
3. Start the built-in live server via "hugo server".

Visit https://gohugo.io/ for quickstart guide and full documentation.
trying URL 'https://github.com/yihui/hugo-xmin/archive/master.zip'
Content type 'application/zip' length 78939 bytes (77 KB)
downloaded 77 KB

Rendering content/_index.Rmarkdown
Warning message:
In eval(quote({ :
  The xaringan package is not installed. LaTeX math may not work well.
Rendering content/post/2015-07-23-r-rmarkdown.Rmd
[1] FALSE
Warning message:
In file.create(to[okay]) :
  cannot create file '../README.md', reason 'Permission denied'
/usr/bin/sed: can't read : No such file or directory
/usr/bin/sed: can't read ../README.md: Permission denied
Warning message:
running command 'sed -i '' -e '1,6d' -e '34,38d' ../README.md' had status 2 
Error in file(file, ifelse(append, "a", "w")) : 
  cannot open the connection
Calls: cat -> file
In addition: Warning message:
In file(file, ifelse(append, "a", "w")) :
  cannot open file '../README.md': Permission denied
Execution halted
Error in run_script("R/build.R", as.character(local)) : 
  Failed to run R/build.R
In addition: Warning message:
running command '"C:/PROGRA~1/R/R-34~1.2/bin/x64/Rscript" "R/build.R" TRUE' had status 1

我已尝试更新 Hugo。 我还尝试使用 Rstudio create Project 等创建网站...使用这种方式,我可以制作网站,但如果我调用 blogdown::server_site()` 函数,它会返回上述错误。

编辑:

我提供sessionInfo()的结果:

R version 3.4.2 (2017-09-28)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:
[1] LC_COLLATE=Croatian_Croatia.1250  LC_CTYPE=Croatian_Croatia.1250    LC_MONETARY=Croatian_Croatia.1250
[4] LC_NUMERIC=C                      LC_TIME=Croatian_Croatia.1250    

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

loaded via a namespace (and not attached):
 [1] compiler_3.4.2  backports_1.1.1 magrittr_1.5    bookdown_0.5    rprojroot_1.2   htmltools_0.3.6 tools_3.4.2    
 [8] rstudioapi_0.7  yaml_2.1.14     Rcpp_0.12.13    stringi_1.1.5   rmarkdown_1.6   blogdown_0.1    knitr_1.17     
[15] stringr_1.2.0   digest_0.6.12   evaluate_0.10.1

【问题讨论】:

  • 请始终提供您的sessionInfo()。听起来你在使用 cygwin?

标签: r blogdown


【解决方案1】:

您可以安全地删除 R 脚本 R/build.R,然后再次运行 serve_site()

setwd("E:/data/R/EconStats") # try RStudio Project to avoid setwd() every time
blogdown::serve_site()

【讨论】:

  • 我找不到脚本R/build.R。我现在将提供 sessionInfo()。
  • 我已关闭所有 R studio 会话并重试。我已成功启动新站点。但是,很少有警告。我不确定他们有多严重:running command 'sed -i '' -e '1,6d' -e '34,38d' ../README.md' had status 2 The xaringan package is not installed. LaTeX math may not work well.Warning: stack imbalance in 'lazyLoadDBfetch', 66 then 63Warning: stack imbalance in '-', 61 then 58
  • 对不起,我很困惑。当我首先使用网站制作项目时,blogdown::serve_site() 函数再次返回与问题相同的错误。所以,这不是多个 R 会话运行的问题。
  • 我找到了 build.R 文件。它在路径C:Users/&lt;user&gt;/Mydocuments/E;/data/R/R 中。文件夹E; 是做什么用的?它与 with blogdown 包有什么关系吗?
  • 我无法编辑最后一条评论。我的网站默认路​​径是E:/data/R
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-07-09
  • 1970-01-01
  • 2021-01-12
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多