按照谢益辉老师的书中流程,我打算建立一个博客。blogdown::serve_site()
之后可以在RStudio的viewer里面看到网页,但到了blogdown::hugo_build()
这一步,就报错了。报错之后,依然会在我项目目录下生成public文件夹,但把该文件夹的内容全部拖到netlify,访问netlify网会报错。
> blogdown::hugo_build()
Start building sites 鈥?
Total in 69 ms
Error: Error copying static files: chtimes E:\r-project\blogdown\public\: The parameter is incorrect.
Start building sites 鈥?
Total in 75 ms
Error: Error copying static files: chtimes E:\r-project\blogdown\public\: The parameter is incorrect.
'C:/Users/yezl/AppData/Roaming/Hugo/0.80.0/hugo.exe" -d "public' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
Error in shell(cmd, mustWork = TRUE, intern = intern) :
'"C:/Users/yezl/AppData/Roaming/Hugo/0.80.0/hugo.exe" -d "public" --themesDir themes -t hugo-lithium' execution failed with error code 1
以下是我的软件配置:
> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936
[2] LC_CTYPE=Chinese (Simplified)_China.936
[3] LC_MONETARY=Chinese (Simplified)_China.936
[4] LC_NUMERIC=C
[5] LC_TIME=Chinese (Simplified)_China.936
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 bookdown_0.21 ps_1.3.3 packrat_0.5.0
[5] digest_0.6.25 later_1.1.0.1 R6_2.4.1 jsonlite_1.7.0
[9] magrittr_1.5 evaluate_0.14 blogdown_1.0 rlang_0.4.6
[13] rstudioapi_0.11 promises_1.1.1 rmarkdown_2.6 tools_4.0.2
[17] servr_0.21 processx_3.4.3 httpuv_1.5.4 xfun_0.20
[21] yaml_2.2.1 compiler_4.0.2 htmltools_0.5.0 knitr_1.30
> blogdown::hugo_version()
[1] ‘0.80.0’
解决方法:
tctcab老师提出,这个问题是由我的硬盘分区为fat32导致的。我查看硬盘分区类型,发现项目文件所在硬盘分区格式果然是fat32,(先备份)后重新格式化为NTFS格式。代码运行成功
谢益辉老师也提出了一个解决方案,但我暂时还没有验证