我刚刚开始在GitHub页面上使用Jekyll,而且我遇到了一些问题。我一直希望能够使用this theme,尽管它已经过时了。我已将repo克隆到我的电脑上并运行bundle install
以开始工作。
为了清楚起见,我没有网络开发背景。我实际上是一名Android开发人员,希望创建自己的关于Android开发的博客(以及其他任何想到的东西)。因此,我并不完全清楚这些命令的作用,例如bundle install
或为什么在这种情况下需要运行它。
考虑到这一点,我继续尝试jekyll serve
,并显示以下信息:
WARN: Unresolved specs during Gem::Specification.reset:
rouge (< 4, >= 1.7)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
/home/mike/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:313:in `check_for_activated_spec!': You have already activated public_suffix 3.0.2, but your Gemfile requires public_suffix 2.0.5. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
from /home/mike/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:31:in `block in setup'
from /home/mike/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:26:in `map'
from /home/mike/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.16.1/lib/bundler/runtime.rb:26:in `setup'
from /home/mike/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/bundler-1.16.1/lib/bundler.rb:107:in `setup'
from /home/mike/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/jekyll-3.7.3/lib/jekyll/plugin_manager.rb:50:in `require_from_bundler'
from /home/mike/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/jekyll-3.7.3/exe/jekyll:11:in `<top (required)>'
from /home/mike/.rbenv/versions/2.3.1/bin/jekyll:23:in `load'
from /home/mike/.rbenv/versions/2.3.1/bin/jekyll:23:in `<main>
如果我使用bundle exec jekyll serve
,我有我的本地服务器,可以预览主题。但是,为什么我需要预先添加'bundle exec'才能让事情发挥作用?是否有关于显示这些消息的担忧?有什么方法可以纠正它们吗?
此外,除了创建别名之外,有什么方法可以进行更正以便我需要做的只是jekyll serve
吗?非常感谢对此的任何澄清和支持!
如果它有帮助,这就是Gemfile的样子:
source "https://rubygems.org"
ruby RUBY_VERSION
# Hello! This is where you manage which Jekyll version is used to run.
# When you want to use a different version, change it below, save the
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
#
# bundle exec jekyll serve
#
# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!
# gem "jekyll", "3.7.3"
# This is the default theme for new Jekyll sites. You may change this to anything you like.
# gem "minima"
# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
gem "github-pages", group: :jekyll_plugins
# If you have any plugins, put them here!
# group :jekyll_plugins do
# gem "jekyll-github-metadata", "~> 1.0"
# end
答案 0 :(得分:1)
bundle exec
确保将在其中运行的ruby程序将Gemfile
指定的宝石用于您所在的项目。当您安装了多个版本的宝石时,它会有所帮助 - 选择正确的版本而不是默认/最新版本。
在您的情况下,错误消息显示You have already activated public_suffix 3.0.2, but your Gemfile requires public_suffix 2.0.5.
您安装了更新版本的gem,但您需要更旧版本。这就是为什么jekyll serve
无法在没有预先加bundle exec
的情况下启动的原因。
您可以使用gemsets分隔您的宝石,以避免此问题。因为你只需要使用jekyll,我建议尽管使用别名。它更容易,我认为没有必要在这里做任何事情。