问题
I am a blogdown begginner and I cant't get started due to an issue with what I think is my session unable to use the hugo.exe
In RStudio I create a new proyect and in that project I run this code which outputs this:
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
When I try tu run again blogdown::new_site() it gives me this:
'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
I have intalled hugo by myself and use:
options(blogdown.hugo.dir = "C:\\Hugo\bin")
install_hugo()
I also have let install_hugo() to do default install in that bin.
I have also add it as a system environment variable but nothing seems to work.
Any help?
The weird thing is that i can do this:
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
EDIT:
By reinstalling everything and running it again in a new proyect and an empty dir, new_page() created all files but gave me this, but I suspect is the same issue:
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
回答1:
You can get this error if you are using OneDrive, and if OneDrive is in "Files on demand" cloud sync mode. Blogdown inherits this from Hugo, which is itself inheriting the behaviour from Go. For the full details, see this Hugo issue discussion:
https://github.com/gohugoio/hugo/issues/4079
The suggestion on there is that this will be fixed in a forthcoming Go update, which will presumably filter through into Hugo and hence Blogdown in due course.
In the meantime, if you are using OneDrive, the option that worked for me was to switch it out of 'Files On Demand' syncing mode. To do that, open OneDrive settings, go to the settings tab, and there should be a checkbox for Files on demand. If you uncheck that, it will download all files, and then Go will be able to see the folders as real folders.
来源:https://stackoverflow.com/questions/49762787/blogdown-not-able-to-recognize-hugo-exe