Netlify部署“在阶段“构建站点”期间失败:构建脚本返回了非零退出代码:42”

时间:2019-06-27 15:05:11

标签: ruby rubygems jekyll web-deployment netlify

我试图将我的Jekyll静态站点部署到Netlify(通过GitHub),但未成功。

错误消息是:

  

”在阶段“构建站点”期间失败:构建脚本返回非零   退出代码:42英寸

以下是完整的Netlify日志:

GeneralizedNewtypeDeriving

日志的最后一条语句是:

  

Ruby Sass已经到了使用寿命,应该不再使用。

我误以为Ruby Sass是需要解决的问题。附加了我的Gemfile和Gemfile.lock(以及Netlify日志)后,@JayDorsey很好地建议(在下面的回答中)Ruby Sass不是问题。

最终更新:发现的解决方案

在专门搜索了Netlify错误代码“ 42”之后,我发现了此信息(https://jameshfisher.com/2019/01/09/how-to-fix-activating-bundler-2-failed-error-in-your-jekyll-build/),并立即解决了该错误。

最适合我的解决方案是删除

basicUnsafeNew

来自我的Gemfile.lock。

以下是我原始的Gemfile.lock,您会注意到它以必须删除的代码结尾:

5:06:23 PM: Preparing Git Reference refs/heads/master
5:06:23 PM: Starting build script
5:06:23 PM: Installing dependencies
5:06:24 PM: Downloading and installing node v10.16.0...
5:06:25 PM: Downloading https://nodejs.org/dist/v10.16.0/node-v10.16.0-linux-x64.tar.xz...
5:06:25 PM: 
##########################
5:06:25 PM:                            37.2%
5:06:25 PM: 
##########################################
5:06:25 PM:                         58.4%
5:06:25 PM: 
################################################
5:06:25 PM: ######################## 100.0%
5:06:25 PM: Computing checksum with sha256sum
5:06:25 PM: Checksums matched!
5:06:28 PM: Now using node v10.16.0 (npm v6.9.0)
5:06:28 PM: Unknown ruby interpreter version (do not know how to handle): RUBY_VERSION.
5:06:28 PM: Attempting ruby version 2.6.2, read from environment
5:06:29 PM: Using ruby version 2.6.2
5:06:29 PM: Using PHP version 5.6
5:06:29 PM: Started restoring cached ruby gems
5:06:29 PM: Finished restoring cached ruby gems
5:06:29 PM: Installing gem bundle
5:06:30 PM: Warning: the running version of Bundler (2.0.1) is older than the version that created the lockfile (2.0.2). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
5:06:31 PM: Fetching gem metadata from https://rubygems.org/
5:06:33 PM: Fetching public_suffix 3.1.1
5:06:33 PM: Installing public_suffix 3.1.1
5:06:33 PM: Fetching addressable 2.6.0
5:06:33 PM: Installing addressable 2.6.0
5:06:33 PM: Using bundler 2.0.1
5:06:33 PM: Fetching colorator 1.1.0
5:06:33 PM: Installing colorator 1.1.0
5:06:33 PM: Fetching concurrent-ruby 1.1.5
5:06:33 PM: Installing concurrent-ruby 1.1.5
5:06:33 PM: Fetching eventmachine 1.2.7
5:06:33 PM: Installing eventmachine 1.2.7 with native extensions
5:06:49 PM: Fetching http_parser.rb 0.6.0
5:06:49 PM: Installing http_parser.rb 0.6.0 with native extensions
5:06:50 PM: Fetching em-websocket 0.5.1
5:06:50 PM: Installing em-websocket 0.5.1
5:06:50 PM: Fetching ffi 1.11.1
5:06:51 PM: Installing ffi 1.11.1 with native extensions
5:06:59 PM: Fetching forwardable-extended 2.6.0
5:06:59 PM: Installing forwardable-extended 2.6.0
5:06:59 PM: Fetching i18n 0.9.5
5:06:59 PM: Installing i18n 0.9.5
5:06:59 PM: Fetching rb-fsevent 0.10.3
5:07:00 PM: Installing rb-fsevent 0.10.3
5:07:00 PM: Fetching rb-inotify 0.10.0
5:07:00 PM: Installing rb-inotify 0.10.0
5:07:00 PM: Fetching sass-listen 4.0.0
5:07:00 PM: Installing sass-listen 4.0.0
5:07:00 PM: Fetching sass 3.7.4
5:07:00 PM: Installing sass 3.7.4
5:07:00 PM: Fetching jekyll-sass-converter 1.5.2
5:07:00 PM: Installing jekyll-sass-converter 1.5.2
5:07:00 PM: Fetching ruby_dep 1.5.0
5:07:00 PM: Installing ruby_dep 1.5.0
5:07:00 PM: Fetching listen 3.1.5
5:07:00 PM: Installing listen 3.1.5
5:07:00 PM: Fetching jekyll-watch 2.2.1
5:07:00 PM: Installing jekyll-watch 2.2.1
5:07:00 PM: Fetching kramdown 1.17.0
5:07:01 PM: Installing kramdown 1.17.0
5:07:01 PM: Fetching liquid 4.0.3
5:07:01 PM: Installing liquid 4.0.3
5:07:01 PM: Fetching mercenary 0.3.6
5:07:01 PM: Installing mercenary 0.3.6
5:07:01 PM: Fetching pathutil 0.16.2
5:07:01 PM: Installing pathutil 0.16.2
5:07:01 PM: Fetching rouge 3.5.1
5:07:02 PM: Installing rouge 3.5.1
5:07:02 PM: Fetching safe_yaml 1.0.5
5:07:02 PM: Installing safe_yaml 1.0.5
5:07:02 PM: Fetching jekyll 3.8.5
5:07:02 PM: Installing jekyll 3.8.5
5:07:02 PM: Fetching jekyll-feed 0.12.1
5:07:02 PM: Installing jekyll-feed 0.12.1
5:07:02 PM: Fetching jekyll-paginate 1.1.0
5:07:02 PM: Installing jekyll-paginate 1.1.0
5:07:02 PM: Fetching jekyll-seo-tag 2.6.1
5:07:02 PM: Installing jekyll-seo-tag 2.6.1
5:07:02 PM: Fetching jekyll-sitemap 1.3.1
5:07:05 PM: failed during stage 'building site': Build script returned non-zero exit code: 42
5:07:02 PM: Installing jekyll-sitemap 1.3.1
5:07:02 PM: Bundle complete! 4 Gemfile dependencies, 30 gems now installed.
5:07:02 PM: Bundled gems are installed into `/opt/build/cache/bundle`
5:07:02 PM: Post-install message from sass:
5:07:02 PM: Ruby Sass has reached end-of-life and should no longer be used.

1 个答案:

答案 0 :(得分:0)

您看到的错误应该只是警告,不应影响部署。我会再次仔细检查netlify日志,看看是否可以找到另一个错误。

jekyll-sass-converter的最新已发布版本仍使用sass gem。看来他们尚未发布使用sassc的新版本。

如果将以下内容添加到Gemfile中,然后运行bundle install,Jekyll将选择使用sassc而不是sass的版本,并使您摆脱看到的警告< / p>

gem 'jekyll-sass-converter', git: 'https://github.com/jekyll/jekyll-sass-converter', branch: 'master'

如果这不起作用,请先尝试在本地构建您的网站,看看是否出现任何错误