- 已编辑
昨天收到 @yufree 的审稿邀请,今天试着把主站仓库克隆到本地预览,结果网页一片空白。下面是复现过程:
git clone https://github.com/cosname/cosx.org.git
cd cosx.org
git reset --hard 672d186
rstudio-bin cosx.Rproj
我看了主站的 HTML 源码,里面写着 <meta name="generator" content="Hugo 0.25.1" />
,我就在 .Rprofile
加上 blogdown.hugo.version = "0.25.1"
,指定使用 Hugo 0.25.1。这是完整的 .Rprofile
:
if (file.exists('~/.Rprofile')) sys.source('~/.Rprofile', globalenv())
options(
digits = 4, servr.daemon = TRUE, formatR.indent = 2,
blogdown.yaml.empty = FALSE, blogdown.publishDir = '../cosx-public',
blogdown.hugo.version = "0.25.1"
)
local({
pandoc_path = Sys.getenv('RSTUDIO_PANDOC', NA)
if (Sys.which('pandoc') == '' && !is.na(pandoc_path)) Sys.setenv(PATH = paste(
Sys.getenv('PATH'), pandoc_path,
sep = if (.Platform$OS.type == 'unix') ':' else ';'
))
})
> blogdown:::serve_site()
Launching the server via the command:
/home/hunter/.local/share/Hugo/0.25.1/hugo server --bind 127.0.0.1 -p 4321 --themesDir themes -t hugo-xmag -D -F --navigateToChanged
Serving the directory . at http://localhost:4321
Launched the hugo server in the background (process ID: 208179). To stop it, call blogdown::stop_server() or restart the R session.
打开 http://localhost:4321/
,一片空白,页面 HTML 代码是:
<pre>
</pre>
这是我的软件信息:
> sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Arch Linux
Matrix products: default
BLAS: /usr/lib/libblas.so.3.10.0
LAPACK: /usr/lib/liblapack.so.3.10.0
locale:
[1] LC_CTYPE=en_US.UTF-8
[2] LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8
[6] LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8
[8] LC_NAME=C
[9] LC_ADDRESS=C
[10] LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8
[12] LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils
[5] datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.1.2 magrittr_2.0.1
[3] R6_2.5.1 bookdown_0.24
[5] promises_1.2.0.1 later_1.3.0
[7] tools_4.1.2 rstudioapi_0.13
[9] yaml_2.2.1 Rcpp_1.0.7
[11] blogdown_1.6 knitr_1.36
[13] jsonlite_1.7.2 xfun_0.28
[15] httpuv_1.6.3 rlang_0.4.12
[17] servr_0.24
怎样才能在本地预览呢?