在离开几个月后,我尝试在 GitHub 页面上的博客上发布一篇文章,但收到以下错误:
Gem::InstallError: public_suffix requires Ruby version >= 2.0. Installing sass 3.4.20 An error occurred while installing public_suffix (1.5.2), and Bundler cannot continue. Make sure that
gem install public_suffix -v '1.5.2'
succeeds before bundling.
但是根据 GitHub 的说法,GH 页面上的 Ruby 版本已经 > 2.0。我需要在博客的代码库中进行一些编程更改才能使其启动并运行吗?
这是对应的Gemfile:
source 'https://rubygems.org'
# A simple Ruby Gem to bootstrap dependencies for setting up and
# maintaining a local Jekyll environment in sync with GitHub Pages
# https://github.com/github/pages-gem
gem 'github-pages'
最佳答案
尝试删除您的 gemfile.lock
并从 GitHub Pages 存储库中提取最后一个有效的 gemfile.lock
文件。 (或者只是从之前的工作提交中 checkout 文件)
大多数奇怪的错误都源于 Gemfile.lock
文件的错误,该文件用于跟踪每个 Ruby Gem 的版本。有时,在运行bundle update
时,会尝试升级gem,这可能会破坏与其他gem的兼容性,至少我以前就遇到过这种情况。通常,运行bundle update
会导致某些gem降级。作为让 Jekyll 在本地构建的临时解决方法,只需将文件恢复到早期版本即可。
关于ruby - GitHub 页面未构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34687732/