【问题标题】:Hugo Netlify Build Process Failed: Exit Code 255Hugo Netlify 构建过程失败:退出代码 255
【发布时间】:2022-04-08 21:49:56
【问题描述】:

我正在尝试将我的 Hugo 网站上传到 Netlify,但在构建过程中我收到了 Command failed with exit code 255: hugo 错误。由于这是我自己手工编写的,我确信在这个过程中我遗漏了一些重要的文件,这会导致一切都失败。

我的整个 repo 上传到这里:https://github.com/thedivtagguy/srishtiarchives

部署日志如下:

6:48:17 PM: Build ready to start
6:48:20 PM: build-image version: d84c79427e8f83c1ba17bcdd7b3fe38059376b68
6:48:20 PM: build-image tag: v3.6.1
6:48:20 PM: buildbot version: 3f7ff7bbf92b8c2ecf180659ea5b1472b472d308
6:48:20 PM: Fetching cached dependencies
6:48:20 PM: Failed to fetch cache, continuing with build
6:48:20 PM: Starting to prepare the repo for build
6:48:21 PM: No cached dependencies found. Cloning fresh repo
6:48:21 PM: git clone https://github.com/thedivtagguy/srishtiarchives
6:48:21 PM: Preparing Git Reference refs/heads/master
6:48:23 PM: Starting build script
6:48:23 PM: Installing dependencies
6:48:23 PM: Python version set to 2.7
6:48:24 PM: v12.18.0 is already installed.
6:48:25 PM: Now using node v12.18.0 (npm v6.14.4)
6:48:25 PM: Started restoring cached build plugins
6:48:25 PM: Finished restoring cached build plugins
6:48:25 PM: Attempting ruby version 2.7.1, read from environment
6:48:26 PM: Using ruby version 2.7.1
6:48:27 PM: Using PHP version 5.6
6:48:27 PM: Installing Hugo 0.54.0
6:48:28 PM: Hugo Static Site Generator v0.54.0-B1A82C61A/extended linux/amd64 BuildDate: 2019-02-01T10:04:38Z
6:48:28 PM: Started restoring cached go cache
6:48:28 PM: Finished restoring cached go cache
6:48:28 PM: go version go1.14.4 linux/amd64
6:48:28 PM: go version go1.14.4 linux/amd64
6:48:28 PM: Installing missing commands
6:48:28 PM: Verify run directory
6:48:29 PM: ​
6:48:29 PM: ────────────────────────────────────────────────────────────────
6:48:29 PM:   Netlify Build                                                 
6:48:29 PM: ────────────────────────────────────────────────────────────────
6:48:29 PM: ​
6:48:29 PM: ❯ Version
6:48:29 PM:   @netlify/build 9.1.2
6:48:29 PM: ​
6:48:29 PM: ❯ Flags
6:48:29 PM:   deployId: 602e6919def5380007a9640a
6:48:29 PM:   mode: buildbot
6:48:29 PM: ​
6:48:29 PM: ❯ Current directory
6:48:29 PM:   /opt/build/repo
6:48:29 PM: ​
6:48:29 PM: ❯ Config file
6:48:29 PM:   /opt/build/repo/netlify.toml
6:48:29 PM: ​
6:48:29 PM: ❯ Context
6:48:29 PM:   production
6:48:29 PM: ​
6:48:29 PM: ────────────────────────────────────────────────────────────────
6:48:29 PM:   1. build.command from netlify.toml                            
6:48:29 PM: ────────────────────────────────────────────────────────────────
6:48:29 PM: ​
6:48:29 PM: $ hugo
6:48:30 PM: ERROR 2021/02/18 13:18:30 ARCHIVES theme does not support Hugo version 0.54.0. Minimum version required is 0.69
6:48:30 PM: Building sites … ERROR 2021/02/18 13:18:30 render of "page" failed: execute of template failed: template: _default/single.html:3:7: executing "_default/single.html" at <partial "head.html" ...>: error calling partial: "/opt/build/repo/themes/archives/layouts/partials/head.html:22:55": execute of template failed: template: partials/head.html:22:55: executing "partials/head.html" at <resources>: can't evaluate field PostProcess in type interface {}ERROR 2021/02/18 13:18:30 render of "page" failed: execute of template failed: template: _default/single.html:3:7: executing "_default/single.html" at <partial "head.html" ...>: error calling partial: "/opt/build/repo/themes/archives/layouts/partials/head.html:22:55": execute of template failed: template: partials/head.html:22:55: executing "partials/head.html" at <resources>: can't evaluate field PostProcess in type interface {}ERROR 2021/02/18 13:18:30 render of "page" failed: execute of template failed: template: _default/guide.html:3:7: executing "_default/guide.html" at <partial "head.html" ...>: error calling partial: "/opt/build/repo/themes/archives/layouts/partials/head.html:22:55": execute of template failed: template: partials/head.html:22:55: executing "partials/head.html" at <resources>: can't evaluate field PostProcess in type interface {}ERROR 2021/02/18 13:18:30 render of "page" failed: execute of template failed: template: _default/single.html:3:7: executing "_default/single.html" at <partial "head.html" ...>: error calling partial: "/opt/build/repo/themes/archives/layouts/partials/head.html:22:55": execute of template failed: template: partials/head.html:22:55: executing "partials/head.html" at <resources>: can't evaluate field PostProcess in type interface {}Total in 9 ms
6:48:30 PM: Error: Error building site: failed to render pages: render of "page" failed: execute of template failed: template: _default/single.html:3:7: executing "_default/single.html" at <partial "head.html" ...>: error calling partial: "/opt/build/repo/themes/archives/layouts/partials/head.html:22:55": execute of template failed: template: partials/head.html:22:55: executing "partials/head.html" at <resources>: can't evaluate field PostProcess in type interface {}​
6:48:30 PM: ────────────────────────────────────────────────────────────────
6:48:30 PM:   "build.command" failed                                        
6:48:30 PM: ────────────────────────────────────────────────────────────────
6:48:30 PM: ​
6:48:30 PM:   Error message
6:48:30 PM:   Command failed with exit code 255: hugo
6:48:30 PM: ​
6:48:30 PM:   Error location
6:48:30 PM:   In build.command from netlify.toml:
6:48:30 PM:   hugo
6:48:30 PM: ​
6:48:30 PM:   Resolved config
6:48:30 PM:   build:
6:48:30 PM:     command: hugo
6:48:30 PM:     commandOrigin: config
6:48:30 PM:     environment:
6:48:30 PM:       - HUGO_VERSION
6:48:30 PM:       - HUGO_ENV
6:48:30 PM:       - HUGO_ENABLEGITINFO
6:48:30 PM:     publish: /opt/build/repo/public
6:48:30 PM: Caching artifacts
6:48:30 PM: Started saving build plugins
6:48:30 PM: Finished saving build plugins
6:48:30 PM: Started saving pip cache
6:48:30 PM: Finished saving pip cache
6:48:30 PM: Started saving emacs cask dependencies
6:48:30 PM: Finished saving emacs cask dependencies
6:48:30 PM: Started saving maven dependencies
6:48:30 PM: Finished saving maven dependencies
6:48:30 PM: Started saving boot dependencies
6:48:30 PM: Finished saving boot dependencies
6:48:30 PM: Started saving rust rustup cache
6:48:30 PM: Finished saving rust rustup cache
6:48:30 PM: Started saving go dependencies
6:48:30 PM: Finished saving go dependencies
6:48:33 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
6:48:33 PM: Failing build: Failed to build site
6:48:33 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2
6:48:33 PM: Finished processing build request in 12.654455975s

根据我在论坛上找到的先前答案,我认为这是因为我缺少 netlify.toml 文件(我曾经是),所以我添加了以下内容:

[build] 
  publish = "public"
  command = "hugo"

[context.production.environment]
  HUGO_VERSION = "0.54.0" # if older, use format: 0.53 (no trailing zero)
  HUGO_ENV = "production"
  HUGO_ENABLEGITINFO = "true"
  
[context.branch-deploy.environment]
  HUGO_VERSION = "0.54.0" # if older, use format: 0.53 (no trailing zero)

[context.deploy-preview.environment]
  HUGO_VERSION = "0.54.0"

这也无法修复错误。我做错了什么,我该如何解决?

【问题讨论】:

    标签: netlify hugo


    【解决方案1】:

    在您的部署日志中有一条关于支持的最低版本的信息:Minimum version required is 0.69,尝试通过将HUGO_VERSION 更改为0.69.0(或更高版本,请参阅releases)来更新您的 netlify.toml 文件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-09-22
      • 1970-01-01
      • 1970-01-01
      • 2019-05-02
      • 1970-01-01
      • 1970-01-01
      • 2014-01-04
      相关资源
      最近更新 更多