我正在使用Cloud9和GitHub(Private Repos)。我已经能够将基本登陆页面部署到Netlify,但是当我尝试部署任何Jekyll站点时,我仍然收到相同的错误消息。部署日志中的代码段:
> Installing gem bundle
> You must use Bundler 2 or greater with this lockfile.
> Error during gem install
> failed during stage 'building site': Build script returned non-zero exit code: 1
> Error running command: Build script returned non-zero exit code: 1
> Failing build: Failed to build site
经过多次尝试失败后,我创建了一个新的测试开发环境。 Per Jekyll docs我确保我拥有最新的Ruby,RubyGems,gcc,g ++,make和dependencies。通常配置,然后Jekyll新test_directory。脚步:
> gem install jekyll bundler
> gem install bundle
> gem update --system
> cd new_directory && bundle install
> ~/new_directory/ bundle update
> ~/new_directory/ bundle exec jekyll serve
*** Works perfectly on localhost ***
在这一点上一切都很好(jekyll 3.8.5 - gem 3.0.2 - ruby 2.5.1p57(2018-03-29 revision 63029)[x86_64-linux]) 重要:
> bundler -v
returns
> Bundler version 2.0.1
在推送到全新的repo之后,我得到与上面相同的错误消息: “将Bundler 2或更高版本与此lockfile一起使用”
来自lockfile的片段:
> DEPENDENCIES
> -jekyll (~> 3.8.5)
> -jekyll-feed (~> 0.6)
> -minima (~> 2.0)
> -tzinfo-data
> RUBY VERSION
> ruby 2.5.1p57
> BUNDLED WITH
> 2.0.1
我还将此添加到_config.yml文件中:
> url: "https://infallible-hodgkin-e15692.netlify.com/"
根据Netlify文档,我使用以下行在我的根目录中添加了一个/.ruby-version文件:
> ruby 2.5.1
在更新了所有内容和git push之后,它仍然无法构建我的站点,但这次我在部署日志上获得了几个新行:
>** WARNING **
> Using custom ruby version ruby 2.5.1, this will slow down the build.
> To ensure fast builds, set the RUBY_VERSION environment variable, or .ruby-version file, to an included ruby version.
> Included versions: 2.3.6 2.4.3 2.2.9
不用说我尝试切换到每个“包含”Ruby -v(rvm使用.. *)。每次都要完成安装每个版本和重复步骤的过程。没运气。
非常感谢任何关于下一步尝试的建议。对不起,我试着尽可能简洁。如果我遗漏了什么,请告诉我。
所以问题是我应该使用Bundle 1而不是Bundle 2加ruby 2.3.6。确保您使用的是捆绑版本1.您可以在此处阅读更多内容: https://bundler.io/guides/bundler_2_upgrade.html
切换到红宝石2.3.6:
> rvm use 2.3.6 (it'll give you the prompt to install it)
在项目的根目录上运行此命令,通过运行bundle版本检查它是否有效
> gem install bundler -v "~>1.0"
然后
> gem install jekyll
> gem install bundle
这是我在mi Gemfile.lock上改变的内容:
> RUBY VERSION
> ruby 2.3.6p384
> BUNDLED WITH
> 1.17.3
我的Gemfile只是在顶部说ruby“2.3.6”,我还将/.ruby-version文件更改为ruby 2.3.6(无引号)。就是这样。不要忘记捆绑exec jekyll服务,提交和推送它应该没问题。