根据《用 R 语言的 blogdown+hugo+netlify+github 建博客》一文操作,到netlify配置网页的步骤失败,想请教原因和解决办法。
操作是按照《用 R 语言的 blogdown+hugo+netlify+github 建博客》一文的流程来的。为了使提问更加简洁,下面仅描述一些个性化或者稍有不同的操作,及各步骤对应的效果。关键信息如netlify的Deploy log和我的repo的状态和链接都在下文中。
准备工作
域名申请:在GoDaddy上购买了域名kang1943.com
。
在GitHub上创建repo
设置如下:
blogdown建站
创建项目设置如下:
然后在右下角打开gitignore,根据教程设置,并保存该文件。
初始化 blogdown:
此时我的根目录/kang1943.com文件夹下出现了很多新的文件:
然后本地运行网站,但并未出现警告信息,所以也就没有如教程中所示安装xaringan
等包的步骤,但是在右下方的viewer界面已经能看到网页主页预览了:
在浏览器中输入http://127.0.0.1:4321/也显示同样的页面,没有问题。
新增博客:
之后右下角viewer界面显示了新增博客的页面。
设置netlify
用邮箱注册了netlify,并且绑定了GitHub。此时目标repo长这样:
在netlify页面中点击New site from Git
,开始连结netlify和GitHub的repo的设置。参考论坛上一个帖子,还新增了hugo版本号变量:
提示配置失败:
点进去查看Deploy log信息如下:
11:12:33 PM: Build ready to start
11:12:35 PM: build-image version: b0258b965567defc4a2d7e2f2dec2e00c8f73ad6
11:12:35 PM: build-image tag: v3.4.1
11:12:35 PM: buildbot version: cdc66b02d86506251d3343610a77385376c8c035
11:12:35 PM: Fetching cached dependencies
11:12:35 PM: Failed to fetch cache, continuing with build
11:12:35 PM: Starting to prepare the repo for build
11:12:35 PM: No cached dependencies found. Cloning fresh repo
11:12:35 PM: git clone https://github.com/kangjf1943/kang1943.com
11:12:36 PM: Preparing Git Reference refs/heads/main
11:12:38 PM: Starting build script
11:12:38 PM: Installing dependencies
11:12:38 PM: Python version set to 2.7
11:12:39 PM: v12.18.0 is already installed.
11:12:40 PM: Now using node v12.18.0 (npm v6.14.4)
11:12:40 PM: Started restoring cached build plugins
11:12:40 PM: Finished restoring cached build plugins
11:12:40 PM: Attempting ruby version 2.7.1, read from environment
11:12:42 PM: Using ruby version 2.7.1
11:12:42 PM: Using PHP version 5.6
11:12:42 PM: 5.2 is already installed.
11:12:42 PM: Using Swift version 5.2
11:12:42 PM: Installing Hugo 0.76.5
11:12:44 PM: Hugo Static Site Generator v0.76.5-60F0725B/extended linux/amd64 BuildDate: 2020-10-14T15:25:14Z
11:12:44 PM: Started restoring cached go cache
11:12:44 PM: Finished restoring cached go cache
11:12:44 PM: go version go1.14.4 linux/amd64
11:12:44 PM: go version go1.14.4 linux/amd64
11:12:44 PM: Installing missing commands
11:12:44 PM: Verify run directory
11:12:45 PM:
11:12:45 PM: ┌─────────────────────────────┐
11:12:45 PM: │ Netlify Build │
11:12:45 PM: └─────────────────────────────┘
11:12:45 PM:
11:12:45 PM: ❯ Version
11:12:45 PM: @netlify/build 5.0.3
11:12:45 PM:
11:12:45 PM: ❯ Flags
11:12:45 PM: deployId: 5f982ad1d16a359c58714feb
11:12:45 PM: mode: buildbot
11:12:45 PM:
11:12:45 PM: ❯ Current directory
11:12:45 PM: /opt/build/repo
11:12:45 PM:
11:12:45 PM: ❯ Config file
11:12:45 PM: No config file was defined: using default values.
11:12:45 PM:
11:12:45 PM: ❯ Context
11:12:45 PM: production
11:12:45 PM:
11:12:45 PM: ┌───────────────────────────────────┐
11:12:45 PM: │ 1. Build command from Netlify app │
11:12:45 PM: └───────────────────────────────────┘
11:12:45 PM:
11:12:45 PM: $ hugo
11:12:45 PM: Total in 0 ms
11:12:45 PM: Error: Unable to locate config file or config directory. Perhaps you need to create a new site.
11:12:45 PM: Run `hugo help new` for details.
11:12:45 PM:
11:12:45 PM: ┌─────────────────────────────┐
11:12:45 PM: │ "build.command" failed │
11:12:45 PM: └─────────────────────────────┘
11:12:45 PM:
11:12:45 PM: Error message
11:12:45 PM: Command failed with exit code 255: hugo
11:12:45 PM:
11:12:45 PM: Error location
11:12:45 PM: In Build command from Netlify app:
11:12:45 PM: hugo
11:12:45 PM:
11:12:45 PM: Resolved config
11:12:45 PM: build:
11:12:45 PM: command: hugo
11:12:45 PM: commandOrigin: ui
11:12:45 PM: environment:
11:12:45 PM: - HUGO_VERSION
11:12:45 PM: publish: /opt/build/repo/public
11:12:45 PM: Caching artifacts
11:12:45 PM: Started saving build plugins
11:12:45 PM: Finished saving build plugins
11:12:45 PM: Started saving pip cache
11:12:45 PM: Finished saving pip cache
11:12:45 PM: Started saving emacs cask dependencies
11:12:45 PM: Finished saving emacs cask dependencies
11:12:45 PM: Started saving maven dependencies
11:12:45 PM: Finished saving maven dependencies
11:12:45 PM: Started saving boot dependencies
11:12:45 PM: Finished saving boot dependencies
11:12:45 PM: Started saving go dependencies
11:12:45 PM: Finished saving go dependencies
11:12:48 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
11:12:48 PM: Failing build: Failed to build site
11:12:48 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
11:12:48 PM: Finished processing build request in 13.687223235s