由于退出错误状态127在netlify上构建Hugo网站时出错

时间:2018-10-28 11:46:49

标签: github themes github-pages hugo netlify

我正在使用Hugo,netlify和github构建一个静态站点。 但是我在关于建筑工地脚本的退出代码127的最后一行出现错误。 这是什么脚本,我该如何解决。 链接-Github repo 我是一个初学者。 预先感谢

    5:10:09 PM: Build ready to start
5:10:10 PM: build-image version: 42bca793ccd33055023c56c4ca8510463a56d317
5:10:10 PM: buildbot version: 15854c92f1b74f9c77ad951b5536193c76eff25e
5:10:11 PM: Fetching cached dependencies
5:10:11 PM: Starting to download cache of 16.7MB
5:10:11 PM: Finished downloading cache in 209.623278ms
5:10:11 PM: Starting to extract cache
5:10:11 PM: Finished extracting cache in 184.94328ms
5:10:11 PM: Finished fetching cache in 452.033931ms
5:10:11 PM: Starting to prepare the repo for build
5:10:11 PM: Preparing Git Reference refs/heads/master
5:10:12 PM: Starting build script
5:10:12 PM: Installing dependencies
5:10:13 PM: Downloading and installing node v8.12.0...
5:10:13 PM: Downloading https://nodejs.org/dist/v8.12.0/node-v8.12.0-linux-x64.tar.xz...
5:10:14 PM:   0.9%
5:10:14 PM: 
#####################
5:10:14 PM:                                                     30.3%
5:10:14 PM: 
#################################
5:10:14 PM: ####################################### 100.0%
5:10:14 PM: Computing checksum with sha256sum
5:10:14 PM: Checksums matched!
5:10:16 PM: Now using node v8.12.0 (npm v6.4.1)
5:10:17 PM: Attempting ruby version 2.3.6, read from environment
5:10:18 PM: Using ruby version 2.3.6
5:10:18 PM: Using PHP version 5.6
5:10:18 PM: Installing Hugo 0.41
5:10:19 PM: Started restoring cached go cache
5:10:19 PM: Finished restoring cached go cache
5:10:19 PM: unset GOOS;
5:10:19 PM: unset GOARCH;
5:10:19 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.10.linux.amd64';
5:10:19 PM: export PATH="/opt/buildhome/.gimme/versions/go1.10.linux.amd64/bin:${PATH}";
5:10:19 PM: go version >&2;
5:10:20 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.10.linux.amd64.env';
5:10:20 PM: go version go1.10 linux/amd64
5:10:20 PM: Installing missing commands
5:10:20 PM: Verify run directory
5:10:20 PM: Executing user command: hugo_0.41
5:10:20 PM: /usr/local/bin/build: line 32: hugo_0.41: command not found
5:10:20 PM: Caching artifacts
5:10:20 PM: Started saving pip cache
5:10:20 PM: Finished saving pip cache
5:10:20 PM: Started saving emacs cask dependencies
5:10:20 PM: Finished saving emacs cask dependencies
5:10:20 PM: Started saving maven dependencies
5:10:20 PM: Finished saving maven dependencies
5:10:20 PM: Started saving boot dependencies
5:10:20 PM: Finished saving boot dependencies
5:10:20 PM: Started saving go dependencies
5:10:20 PM: Finished saving go dependencies
5:10:20 PM: Cached node version v8.12.0
5:10:20 PM: Error running command: Build script returned non-zero exit code: 127
5:10:20 PM: Failing build: Failed to build site
5:10:20 PM: failed during stage 'building site': Build script returned non-zero exit code: 127
5:10:20 PM: Finished processing build request in 9.957599589s

1 个答案:

答案 0 :(得分:2)

Netlify使用的命令hugo_0.41生成Hugo的命令不正确

  

执行用户命令:hugo_0.41

当退出代码为非零时,您的网站构建将失败并且将无法部署。

  

错误运行命令:构建脚本返回了非零退出代码:127

解决方案

通过为生产版本hugo运行正确的命令来解决此问题。还将Hugo版本设置为您的目标版本,看起来像是version 0.41

从存储库控制此操作的最简单方法是在存储库的根目录中创建一个netlify.toml文件。

netlify.toml

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

[build.environment]
  HUGO_VERSION = "0.41"

注意netlify.toml中的值也可以在app.netlify.com在线管理员中设置,但是netlify.toml将覆盖这些值并且也可以使用稍后进行更高级的设置。您还可以通过changing the version number测试Hugo的其他版本。