nano-chenyanlun
public 文件夹是hugo编译好网站之后的网站根目录名称,整个public文件夹是编译的结果,所以原则上不需要版本控制,所以加进ignore名单。

而netlify部署的时候实际上重新编译了一遍网站。所以在参数设置的时候得告诉netlify那个public文件夹就是编译好的网站目录。

    tctcab 谢谢 tctcab 君的详细解释,repo 地址在此

    网站本地可以运行之后,有试过或者不推到 repo,但是 Netlify 部署同样都会失败并提示 non-zero exist(Deploy log 一直刷不出来,不然我可以拷贝过来)。

    已解决。

    Hugo 版本比较高(我的是0.36),Netlify 部署时,需要增加变量(HUGO_VERSION,0.36)。

    可使用 blogdown::hugo_version() 查看 Hugo 版本。

      10 天 后

      CandyBen
      如果使用netlify来配置的话,第一次设置应该在step1里就能设置,之后可以在netlify设置里

      Build & deploy -> continuous deploy -> Build environment variables
      来设置

      10 天 后
      nano-chenyanlun 更改标题为「【已解决】blogdown: Netlify 部署失败,non-zero exist code:255
      7 个月 后

      按上面改了还是不行,不知道为什么,哪位帮忙看看!

      9:08:50 PM: Build ready to start
      9:08:51 PM: build-image version: 42bca793ccd33055023c56c4ca8510463a56d317
      9:08:51 PM: buildbot version: 6bab8b64bbd90091082af19fedf16bf73d502e5e
      9:08:51 PM: Fetching cached dependencies
      9:08:52 PM: Starting to download cache of 254.7KB
      9:08:52 PM: Finished downloading cache in 111.530631ms
      9:08:52 PM: Starting to extract cache
      9:08:52 PM: Failed to fetch cache, continuing with build
      9:08:52 PM: Starting to prepare the repo for build
      9:08:52 PM: No cached dependencies found. Cloning fresh repo
      9:08:52 PM: git clone git@github.com:CaiChunMing/domainname.com
      9:08:53 PM: Preparing Git Reference refs/heads/master
      9:08:53 PM: Starting build script
      9:08:53 PM: Installing dependencies
      9:08:54 PM: Downloading and installing node v8.12.0...
      9:08:54 PM: Downloading https://nodejs.org/dist/v8.12.0/node-v8.12.0-linux-x64.tar.xz...
      9:08:54 PM:
      #
      9:08:54 PM: 1.9%
      9:08:54 PM: #######
      9:08:54 PM: ################################ 54.9%
      9:08:54 PM:
      ############################################
      9:08:55 PM: ############################ 100.0%
      9:08:55 PM: Computing checksum with sha256sum
      9:08:55 PM: Checksums matched!
      9:08:57 PM: Now using node v8.12.0 (npm v6.4.1)
      9:08:58 PM: Attempting ruby version 2.3.6, read from environment
      9:08:58 PM: Using ruby version 2.3.6
      9:08:58 PM: Using PHP version 5.6
      9:08:58 PM: Started restoring cached go cache
      9:08:58 PM: Finished restoring cached go cache
      9:08:58 PM: unset GOOS;
      9:08:58 PM: unset GOARCH;
      9:08:58 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.10.linux.amd64';
      9:08:58 PM: export PATH="/opt/buildhome/.gimme/versions/go1.10.linux.amd64/bin:${PATH}";
      9:08:58 PM: go version >&2;
      9:08:58 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.10.linux.amd64.env';
      9:08:58 PM: go version go1.10 linux/amd64
      9:08:58 PM: Installing missing commands
      9:08:58 PM: Verify run directory
      9:08:58 PM: Executing user command: hugo
      9:08:58 PM: Error: Unable to locate Config file. Perhaps you need to create a new site.
      9:08:58 PM: Run hugo help new for details. (Unsupported Config Type "")
      9:08:58 PM: Caching artifacts
      9:08:58 PM: Started saving pip cache
      9:08:58 PM: Finished saving pip cache
      9:08:58 PM: Started saving emacs cask dependencies
      9:08:58 PM: Finished saving emacs cask dependencies
      9:08:58 PM: Started saving maven dependencies
      9:08:58 PM: Finished saving maven dependencies
      9:08:58 PM: Started saving boot dependencies
      9:08:58 PM: Finished saving boot dependencies
      9:08:58 PM: Started saving go dependencies
      9:08:58 PM: Finished saving go dependencies
      9:08:58 PM: Cached node version v8.12.0
      9:08:58 PM: Error running command: Build script returned non-zero exit code: 255
      9:08:58 PM: Failing build: Failed to build site
      9:08:59 PM: failed during stage 'building site': Build script returned non-zero exit code: 255
      9:08:59 PM: Finished processing build request in 7.304981166s

        tctcab 麻烦再帮忙看看为神马还不行,应该已经添加远程库,也git push -u origin master 然后add 和 commit了。

        11:23:20 PM: Build ready to start
        11:23:21 PM: build-image version: 42bca793ccd33055023c56c4ca8510463a56d317
        11:23:21 PM: buildbot version: 6bab8b64bbd90091082af19fedf16bf73d502e5e
        11:23:21 PM: Fetching cached dependencies
        11:23:21 PM: Starting to download cache of 254.7KB
        11:23:21 PM: Finished downloading cache in 115.010126ms
        11:23:21 PM: Starting to extract cache
        11:23:21 PM: Failed to fetch cache, continuing with build
        11:23:21 PM: Starting to prepare the repo for build
        11:23:22 PM: No cached dependencies found. Cloning fresh repo
        11:23:22 PM: git clone git@github.com:CaiChunMing/domainname.com
        11:23:22 PM: Preparing Git Reference refs/heads/master
        11:23:23 PM: Starting build script
        11:23:23 PM: Installing dependencies
        11:23:24 PM: Downloading and installing node v8.12.0...
        11:23:24 PM: Downloading https://nodejs.org/dist/v8.12.0/node-v8.12.0-linux-x64.tar.xz...
        11:23:24 PM: #
        11:23:24 PM: 1.9%
        11:23:24 PM: #
        11:23:24 PM: ################################### 50.6%
        11:23:24 PM: #
        11:23:24 PM: ####################################################################### 100.0%
        11:23:24 PM: Computing checksum with sha256sum
        11:23:24 PM: Checksums matched!
        11:23:26 PM: Now using node v8.12.0 (npm v6.4.1)
        11:23:26 PM: Attempting ruby version 2.3.6, read from environment
        11:23:27 PM: Using ruby version 2.3.6
        11:23:27 PM: Using PHP version 5.6
        11:23:27 PM: Started restoring cached go cache
        11:23:27 PM: Finished restoring cached go cache
        11:23:27 PM: unset GOOS;
        11:23:27 PM: unset GOARCH;
        11:23:27 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.10.linux.amd64';
        11:23:27 PM: export PATH="/opt/buildhome/.gimme/versions/go1.10.linux.amd64/bin:${PATH}";
        11:23:27 PM: go version >&2;
        11:23:27 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.10.linux.amd64.env';
        11:23:27 PM: go version go1.10 linux/amd64
        11:23:27 PM: Installing missing commands
        11:23:28 PM: Verify run directory
        11:23:28 PM: Executing user command: hugo
        11:23:28 PM: Error: Unable to locate Config file. Perhaps you need to create a new site.
        11:23:28 PM: Run hugo help new for details. (Unsupported Config Type "")
        11:23:28 PM: Caching artifacts
        11:23:28 PM: Started saving pip cache
        11:23:28 PM: Finished saving pip cache
        11:23:28 PM: Started saving emacs cask dependencies
        11:23:28 PM: Finished saving emacs cask dependencies
        11:23:28 PM: Started saving maven dependencies
        11:23:28 PM: Finished saving maven dependencies
        11:23:28 PM: Started saving boot dependencies
        11:23:28 PM: Finished saving boot dependencies
        11:23:28 PM: Started saving go dependencies
        11:23:28 PM: Finished saving go dependencies
        11:23:28 PM: Cached node version v8.12.0
        11:23:28 PM: Error running command: Build script returned non-zero exit code: 255
        11:23:28 PM: Failing build: Failed to build site
        11:23:28 PM: failed during stage 'building site': Build script returned non-zero exit code: 255
        11:23:28 PM: Finished processing build request in 7.216486703s

          CMCai0104

          repo这次没问题了, 我deploy了一下也没问题,从log里没有看到下载新版hugo的步骤,应该是你netlify没设置好,特别是hugo version:

          在netlify第三步Create a new site的地方,

          basic build settings:

          build command: hugo
          publish directory: public

          Advanced build settings:

          key: HUGO_VERSION
          value: 0.42

          然后按deploy site即可
          https://unruffled-yalow-1dbcad.netlify.com/

            试了几次成功了?

            install.packages("devtools")
            devtools::install_github("rstudio/blogdown")
            替换
            blogdown::install_hugo()
            即使能够顺利安装,
            遇到同样问题的可以试试!!

              CMCai0104

              前两个命令是装blogdown包,后一个命令是装hugo,干的事情完全不一样啊。

              而且博客部署是在服务器端的netlify配置出错,跟本地blogdown或者hugo都没关系

              打错了,应该是替换 install.packages("blogdown")

              第二个我不清楚具体原因,部署的网站能够打开了

              20 天 后

              tctcab basic build settings:

              build command: hugo
              publish directory: public

              Advanced build settings:

              key: HUGO_VERSION
              value = 0.49
              都按照要求操作了,但还是部署不了。求帮助!!!!
              11:18:01 PM: Build ready to start
              11:18:03 PM: build-image version: 42bca793ccd33055023c56c4ca8510463a56d317
              11:18:03 PM: buildbot version: 6bab8b64bbd90091082af19fedf16bf73d502e5e
              11:18:03 PM: Fetching cached dependencies
              11:18:03 PM: Failed to fetch cache, continuing with build
              11:18:03 PM: Starting to prepare the repo for build
              11:18:04 PM: No cached dependencies found. Cloning fresh repo
              11:18:04 PM: git clone https://github.com/yuguo807/domainname.com
              11:18:06 PM: Preparing Git Reference refs/heads/master
              11:18:06 PM: Starting build script
              11:18:07 PM: Installing dependencies
              11:18:08 PM: Downloading and installing node v8.12.0...
              11:18:08 PM: Downloading https://nodejs.org/dist/v8.12.0/node-v8.12.0-linux-x64.tar.xz...
              11:18:08 PM:
              #
              11:18:08 PM: 1.6%
              11:18:08 PM: ######
              11:18:08 PM: 9.4%
              11:18:08 PM: #
              11:18:08 PM: ########## 15.5%
              11:18:08 PM: #
              11:18:08 PM: ################# 26.2%
              11:18:08 PM:
              #####################
              11:18:09 PM: #### 35.6%
              11:18:09 PM:
              ################################
              11:18:09 PM: 44.9%
              11:18:09 PM: #
              11:18:09 PM: ##################################### 53.5%
              11:18:09 PM:
              ###################
              11:18:09 PM: ########################## 63.6%
              11:18:09 PM: #
              11:18:09 PM: ################################################### 73.4%
              11:18:09 PM: #
              11:18:09 PM: ########################################################## 83.0%
              11:18:09 PM:
              ###############################
              11:18:09 PM: ################################### 92.9%
              11:18:09 PM:
              #######################
              11:18:09 PM: ################################################# 100.0%
              11:18:09 PM: Computing checksum with sha256sum
              11:18:09 PM: Checksums matched!
              11:18:12 PM: Now using node v8.12.0 (npm v6.4.1)
              11:18:12 PM: Attempting ruby version 2.3.6, read from environment
              11:18:13 PM: Using ruby version 2.3.6
              11:18:14 PM: Using PHP version 5.6
              11:18:14 PM: Installing Hugo 0.49
              11:18:15 PM: Started restoring cached go cache
              11:18:15 PM: Finished restoring cached go cache
              11:18:15 PM: unset GOOS;
              11:18:15 PM: unset GOARCH;
              11:18:15 PM: export GOROOT='/opt/buildhome/.gimme/versions/go1.10.linux.amd64';
              11:18:15 PM: export PATH="/opt/buildhome/.gimme/versions/go1.10.linux.amd64/bin:${PATH}";
              11:18:15 PM: go version >&2;
              11:18:15 PM: export GIMME_ENV='/opt/buildhome/.gimme/env/go1.10.linux.amd64.env';
              11:18:15 PM: go version go1.10 linux/amd64
              11:18:15 PM: Installing missing commands
              11:18:15 PM: Verify run directory
              11:18:15 PM: Executing user command: hugo
              11:18:15 PM: Error: Unable to locate Config file. Perhaps you need to create a new site.
              11:18:15 PM: Run hugo help new for details.
              11:18:15 PM: Caching artifacts
              11:18:15 PM: Started saving pip cache
              11:18:15 PM: Finished saving pip cache
              11:18:15 PM: Started saving emacs cask dependencies
              11:18:15 PM: Finished saving emacs cask dependencies
              11:18:15 PM: Started saving maven dependencies
              11:18:15 PM: Finished saving maven dependencies
              11:18:15 PM: Started saving boot dependencies
              11:18:15 PM: Finished saving boot dependencies
              11:18:15 PM: Started saving go dependencies
              11:18:15 PM: Finished saving go dependencies
              11:18:16 PM: Cached node version v8.12.0
              11:18:16 PM: Error running command: Build script returned non-zero exit code: 255
              11:18:16 PM: Failing build: Failed to build site
              11:18:16 PM: failed during stage 'building site': Build script returned non-zero exit code: 255
              11:18:16 PM: Finished processing build request in 13.154480251s

                1 年 后
                1 年 后

                我也遇到了同样的问题,感谢大家的解决方案。总结来说就是 Hugo 版本的问题。在「RStudio」中输入 blogdown::hugo_version() 得到 Hugo 的版本,然后在「netlify」中的『Site setting』—『Build & develop』—『Environment』中添加 Environment variables,其中 『Key』填 HUGO_VERSION,『Value』填 在「RStudio」得到的 Hugo 版本。

                6 个月 后
                chuxinyuan 更改标题为「blogdown: Netlify 部署失败,non-zero exist code:255