微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

无法在 netlify 上部署 r blogdown 网站

如何解决无法在 netlify 上部署 r 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

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

解决方法

问题可能出在您的 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 号码)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。