无法在 netlify 上部署 r blogdown 网站

时间:2021-01-22 05:01:01

标签: r netlify blogdown

我正在按照 Yihui 的书使用 r blogdown 构建我的第一个网站。 它在 netlify 上首次部署成功。 然后我尝试通过删除它们的文件夹来删除所有示例帖子,这使得内容成为一个空文件夹。 使用 blogdown::build_site(),它返回:

                   | EN  
-------------------+-----
  Pages            |  7  
  Paginator pages  |  0  
  Non-page files   |  0  
  Static files     | 11  
  Processed images |  0  
  Aliases          |  0  
  Sitemaps         |  1  
  Cleaned          |  0 

提交和推送后,我尝试再次部署以查看它,但失败并显示以下信息

12:31:56 PM: Build ready to start
12:31:58 PM: build-image version: d84c79427e8f83c1ba17bcdd7b3fe38059376b68
12:31:58 PM: build-image tag: v3.6.1
12:31:58 PM: buildbot version: 734b021f1afb208e332629f2580fef69fda9a3bc
12:31:58 PM: Building without cache
12:31:58 PM: Starting to prepare the repo for build
12:31:58 PM: No cached dependencies found. Cloning fresh repo
12:31:58 PM: git clone https://github.com/xiangli-xl/xiangli-xl.github.io
12:31:59 PM: Preparing Git Reference refs/heads/master
12:32:00 PM: Failing build: Failed to parse configuration
12:32:00 PM: Failed during stage 'Reading and parsing configuration files': 
Base directory does not exist: /opt/build/repo/xiangli-xl.github.io

: exit status 1
12:32:00 PM: Finished processing build request in 2.485909192s

我该如何解决? 非常感谢~

1 个答案:

答案 0 :(得分:0)

问题可能出在您的 netlify.toml 文件中。将一辉的netlify.toml here与你的here对比,看来你不需要[context](第7行)和[context.production](第12行)。

关于缩进 TOML's documentation 说:缩进被视为空格并被忽略,所以这不应该导致问题。

一辉的netlify.toml文件:

[build]
  command = "hugo"
  publish = "public"
[build.environment]
  HUGO_VERSION = "0.25.1"

[context.branch-deploy]
  command = "hugo -F -b $DEPLOY_PRIME_URL"

[context.deploy-preview]
  command = "hugo -F -b $DEPLOY_PRIME_URL"

[context.production.environment]
  HUGO_ENV = "production"

(注意他使用了一个与你不同的 HUGO_VERSION 号码)