我在 Ubuntu 上运行 Octopress/Jekyll。
当我执行以下命令时:
$ bundle exec rake generate preview
我收到以下错误:
/var/lib/gems/2.3.0/gems/liquid-2.5.5/lib/liquid/htmltags.rb:43:
warning: key "index0" is duplicated and overwritten on line 46
Configuration file: /home/alex/Code/octopress/_config.yml
Source: source
Destination: public
Generating...
jekyll 2.0.0 | Error: undefined method `extname' for
#<Jekyll::StaticFile:0x00000003482d78>
这是我的 Gemfile:
source "https://rubygems.org"
group :development do
gem 'rake', '~> 10.0'
gem 'jekyll', '~> 2.0'
gem 'octopress-hooks', '~> 2.2'
gem 'octopress-date-format', '~> 2.0'
gem 'jekyll-sitemap'
gem 'rdiscount', '~> 2.0'
gem 'RedCloth', '~> 4.2.9'
gem 'haml', '~> 4.0'
gem 'compass', '~> 1.0.1'
gem 'sass-globbing', '~> 1.0.0'
gem 'rb-fsevent', '~> 0.9'
gem 'stringex', '~> 1.4.0'
gem 'pygments.rb'
gem 'maruku'
end
gem 'sinatra', '~> 1.4.2'
有人有什么想法吗? 提前致谢!
最佳答案
我已通过将 Gemfile 更新为以下内容解决了这些错误:
source "https://rubygems.org"
group :development do
gem 'rake', '~> 10.0'
gem 'jekyll', '~> 3.4'
gem 'octopress-hooks', '~> 2.2'
gem 'octopress-date-format', '~> 3.0'
gem 'jekyll-sitemap'
gem 'rdiscount', '~> 2.0'
gem 'RedCloth', '~> 4.2.9'
gem 'haml', '~> 4.0'
gem 'compass', '~> 1.0.1'
gem 'sass-globbing', '~> 1.0.0'
gem 'rb-fsevent', '~> 0.9'
gem 'stringex', '~> 1.4.0'
gem 'pygments.rb', '~> 0.6.3'
gem 'jekyll-paginate'
end
gem 'sinatra', '~> 1.4.2'
请注意,我的 pygments.rb gem 似乎无法正常工作 - 它不会根据语言(即 Ruby)突出显示代码语法:它只是更改字体系列并将其保持为淡灰色(而不是以 ruby 颜色突出显示)。
但这是另一个问题。 目前,最初的错误 - 至少 - 已得到解决。
关于ruby - 启动服务器时出现 Jekyll 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42215137/