blogdown::serve_site() 在 OneDrive 文件夹下不起作用

blogdown::serve_site() does not work under a folder of OneDrive

我最近把我所有的文件都放在Microsoft OneDrive Cloud 文件夹下备份使用。但我发现 blogdown 无法在此类文件夹下正确构建站点。有没有人遇到这样的问题?

总之,这不是blogdown这边的问题,而是hugo这边的问题。现在这个问题应该在比 v0.40.3.

更新的 hugo 版本中得到解决

我测试了使用 RStudio 的 File 菜单创建一个新站点,但是 blogdownOneDrive 下找不到任何目录,并出现以下错误:

Error: C:\Users\zlgsa\OneDrive\Documents\test already exists but not a directory
Error: C:\Users\zlgsa\OneDrive\Documents\test already exists but not a directory
'C:\Users\zlgsa\AppData\Roaming\Hugo\hugo.exe" new site "test' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
Error in shell(cmd, mustWork = TRUE, intern = intern) : 
  '"C:\Users\zlgsa\AppData\Roaming\Hugo\hugo.exe" new site "test" --force -f toml' execution failed with error code 1
In addition: Warning messages:
1: running command '"C:\Users\zlgsa\AppData\Roaming\Hugo\hugo.exe" new site "test" --force -f toml' had status 65535 
2: running command '"C:\Users\zlgsa\AppData\Roaming\Hugo\hugo.exe" new site "test" --force -f toml' had status 65535 
3: running command 'C:\WINDOWS\system32\cmd.exe /c "C:\Users\zlgsa\AppData\Roaming\Hugo\hugo.exe" new site "test" --force -f toml' had status 1 

然后我尝试在OneDrive的子文件夹下创建一个新站点,但blogdown会说该子文件夹不是目录,并显示以下消息:

Error: C:\Users\zlgsa\OneDrive\Documents\test already exists but not a directory
Error: C:\Users\zlgsa\OneDrive\Documents\test already exists but not a directory
'C:\Users\zlgsa\AppData\Roaming\Hugo\hugo.exe" new site ".' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
Error in shell(cmd, mustWork = TRUE, intern = intern) : 
  '"C:\Users\zlgsa\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\zlgsa\AppData\Roaming\Hugo\hugo.exe" new site "." --force -f toml' had status 65535 
2: running command '"C:\Users\zlgsa\AppData\Roaming\Hugo\hugo.exe" new site "." --force -f toml' had status 65535 
3: running command 'C:\WINDOWS\system32\cmd.exe /c "C:\Users\zlgsa\AppData\Roaming\Hugo\hugo.exe" new site "." --force -f toml' had status 1

所以这将是错误的。并查看 this hogo issue。希望这个问题解决后一切都会好起来的。

我在另一个问题上发布了一个答案,但认为值得在此处链接:

简而言之,如果您愿意/能够关闭 OneDrive 的按需同步,则有一个解决方法。我在 Hugo 0.41 中仍然遇到这个错误,更改同步设置解决了这个问题。