使用 blogdown::hugo_install() 安装 hugo 时出错

Error installing hugo using blogdown::hugo_install()

我无法使用 blogdown 包安装 hugo。当我 运行 blogdown::hugo_install() 时,我收到以下消息并看到一个弹出窗口 window,其中包含雨果正在下载的消息。在弹出 window 出现后,R / RStudio 只是挂起。作为参考,我刚刚更新了 R,我的 RStudio 版本是 1.2.5033。我是 运行宁 Windows 10.

The latest Hugo version is 0.69.0 trying URL 'https://github.com/gohugoio/hugo/releases/download/v0.69.0/hugo_extended_0.69.0_Windows-64bit.zipContent length 649 bytes

我也试过 运行ning blogdown:hugo_install(version = 0.69) 。当我 运行 那个时,我得到一个不同的错误:

trying URL 'https://github.com/gohugoio/hugo/releases/download/v0.69/hugo_extended_0.69_Windows-64bit.zip'
trying URL 'https://github.com/gohugoio/hugo/releases/download/v0.69/hugo_extended_0.69_Windows-64bit.zip'
trying URL 'https://github.com/gohugoio/hugo/releases/download/v0.69/hugo_extended_0.69_Windows-64bit.zip'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100     9  100     9    0     0      9      0  0:00:01 --:--:--  0:00:01    44
Error in install_hugo_bin(exec) : 
  Unable to install Hugo to any of these dirs: C:\Users\dougj\AppData\Roaming/Hugo, 
In addition: Warning messages:
1: In download.file(url, output, ..., method = method) :
  cannot open URL 'https://github.com/gohugoio/hugo/releases/download/v0.69/hugo_extended_0.69_Windows-64bit.zip': HTTP status was '404 Not Found'
2: In download.file(url, output, ..., method = method) :
  cannot open URL 'https://github.com/gohugoio/hugo/releases/download/v0.69/hugo_extended_0.69_Windows-64bit.zip': HTTP status was '404 Not Found'
3: In download.file(url, output, ..., method = method) :
  cannot open URL 'https://github.com/gohugoio/hugo/releases/download/v0.69/hugo_extended_0.69_Windows-64bit.zip': HTTP status was '404 Not Found'
4: In utils::unzip(zipfile) : error 1 in extracting from zip file
5: In file.copy(exec, destdir, overwrite = TRUE) :
  problem copying .\hugo.exe to C:\Users\dougj\AppData\Roaming\Hugo\hugo.exe: No such file or directory

最后,我尝试安装 blogdown 的开发版本,下载 hugo 二进制文件,然后使用 blogdown::hugo_install_bin(path_to_unzipped_binary.exe) 手动安装,但是当我尝试这样做时出现此错误:

Error: 'install_hugo_bin' is not an exported object from 'namespace:blogdown'

有什么建议吗?

The latest Hugo version is 0.69.0
trying URL 'https://github.com/gohugoio/hugo/releases/download/v0.69.0/hugo_extended_0.69.0_Windows-64bit.zip'
Content length 649 bytes

根据上面的消息,内容长度似乎不正确 (should be about 13Mb)。我不知道为什么,但你可能在防火墙后面。如果是这种情况,您可以在网络浏览器中下载此 zip 文件,并将 zip 文件的本地文件路径传递给 blogdown::install_hugo(),例如

# change the path below to the actual path of the zip file on your computer
blogdown::install_hugo('~/Downloads/hugo_extended_0.69.0_Windows-64bit.zip')

对于您的其他问题:

I also tried running blogdown:hugo_install(version = 0.69) . When I run that, I get a different error

那是因为没有0.69版本。只有0.69.0(你可以在Github releases page上查看)。

Lastly, I tried installing the dev version of blogdown, downloading the hugo binary, and then manually installing using blogdown::hugo_install_bin(path_to_unzipped_binary.exe)

函数 hugo_install_bin() 未从 blogdown 导出。您并不真的需要它(请改用 install_hugo())。