我是博客的初学者,由于我认为我的会话无法使用hugo.exe的问题,我无法开始使用
在RStudio中,我创建了一个新项目,在该项目中,我运行此代码输出:
dir.create("Web")
setwd("Web")
blogdown::new_site()
The latest Hugo version is 0.38.2
trying URL 'https://github.com/gohugoio/hugo/releases/download/v0.38.2/hugo_0.38.2_Windows 64bit.zip'
length 6164680 bytes (5.9 MB)
downloaded 5.9 MB
Hugo has been installed to C:\Users\Rod\AppData\Roaming\Hugo
Error in if (grepl(r, x)) return(as.numeric_version(gsub(r, "\\1", x))) :
argument is of length zero
当我再试一次blogdown::new_site()
时,它给了我这个:
'C:\Users\Rod\AppData\Roaming\Hugo\hugo.exe" new site ".' is not recognized
as an internal or external command, operable program or batch file.
Error in shell(cmd, mustWork = TRUE, intern = intern) :
'"C:\Users\Rod\AppData\Roaming\Hugo\hugo.exe" new site "." --force -f toml'
execution failed with error code 1
In addition: Warning messages:
1: running command '"C:\Users\Rod\AppData\Roaming\Hugo\hugo.exe" new site "." --force -f toml' had status 65535
2: running command '"C:\Users\Rod\AppData\Roaming\Hugo\hugo.exe" new site "." --force -f toml' had status 65535
3: running command 'C:\WINDOWS\system32\cmd.exe /c
"C:\Users\Rod\AppData\Roaming\Hugo\hugo.exe" new site "." --force -f toml'
had status 1
我自己安装了hugo并使用:
options(blogdown.hugo.dir = "C:\\Hugo\bin")
install_hugo()
我也让install_hugo()
在该垃圾箱中进行默认安装。
我还将它添加为系统环境变量,但似乎没有任何效果。
任何帮助?
奇怪的是我能做到这一点:
shell(paste("C:\\Users\\Rod\\AppData\\Roaming\\Hugo\\hugo.exe", 'version'))
Hugo Static Site Generator v0.38.2 windows/amd64 BuildDate: 2018-04-
09T08:17:46Z
编辑:
通过重新安装所有内容并在新的proyect和空目录中再次运行它,new_page()
创建了所有文件但是给了我这个,但我怀疑是同样的问题:
blogdown::new_site()
trying URL 'https://github.com/yihui/hugo-lithium-theme/archive/master.zip'
Content length 119078 bytes (116 KB)
downloaded 116 KB
Rendering content/post/2015-07-23-r-rmarkdown.Rmd
The system cannot find the path specified.
Error in shell(cmd, mustWork = TRUE, intern = intern) :
'"C:\Users\Rod\AppData\Roaming\Hugo\hugo.exe" -b / -D -F -d "public" -t hugo-lithium-theme' execution failed with error code 1
In addition: Warning messages:
1: running command '"C:\Users\Rod\AppData\Roaming\Hugo\hugo.exe" -b / -D -F -d "public" -t hugo-lithium-theme' had status 65535
2: running command '"C:\Users\Rod\AppData\Roaming\Hugo\hugo.exe" -b / -D -F -d "public" -t hugo-lithium-theme' had status 65535
3: running command 'C:\WINDOWS\system32\cmd.exe /c "C:\Users\Rod\AppData\Roaming\Hugo\hugo.exe" -b / -D -F -d "public" -t hugo-lithium-theme' had status 1
sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
other attached packages:
[1] blogdown_0.5.15
loaded via a namespace (and not attached):
[1] httr_1.3.1 compiler_3.4.4 bookdown_0.7
[4] R6_2.2.2 tools_3.4.4 withr_2.1.2
[7] curl_3.2 yaml_2.1.18 memoise_1.1.0
[10] knitr_1.20 git2r_0.21.0 xfun_0.1
[13] digest_0.6.15 devtools_1.13.5
答案 0 :(得分:0)
如果您使用OneDrive,并且OneDrive处于“文件点播”云同步模式,则可能会出现此错误。 Blogdown从Hugo继承了这一点,Hugo本身继承了Go的行为。有关详细信息,请参阅此Hugo问题讨论:
https://github.com/gohugoio/hugo/issues/4079
有关此问题的建议将在即将推出的Go更新中修复,该更新可能会在适当的时候过滤到Hugo和Blogdown。
与此同时,如果您使用的是OneDrive,那么对我有用的选项就是将其从“按需文件”同步模式切换出来。要做到这一点,打开OneDrive设置,转到设置选项卡,应该有一个按需的文件复选框。如果取消选中,它将下载所有文件,然后Go将能够将文件夹视为真实文件夹。