Jekyll serve error: can't find gem jekyll (>= 0.a) (Gem::GemNotFoundException

我与影子孤独终老i 提交于 2019-12-11 07:29:50

问题


When doing sudo jekyll serve I get the following error:

Users/myusername/.rvm/rubies/ruby-2.4.2/lib/ruby/site_ruby/2.4.0/rubygems.rb:271:in 'find_spec_for_exe': can't find gem jekyll (>= 0.a) (Gem::GemNotFoundException)
from /Users/myusername/.rvm/rubies/ruby-2.4.2/lib/ruby/site_ruby/2.4.0/rubygems.rb:299:in 'activate_bin_path'
from /Users/myusername/.rvm/gems/ruby-2.4.2/bin/jekyll:23:in '<main>'
from /Users/myusername/.rvm/gems/ruby-2.4.2/bin/ruby_executable_hooks:15:in 'eval'
from /Users/myusername/.rvm/gems/ruby-2.4.2/bin/ruby_executable_hooks:15:in '<main>'

In case it helps:

  • jekyll -v returns jekyll 3.6.2
  • ruby -v returns ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin15]
  • gem -v returns 2.6.14
  • bundle -v returns Bundler version 1.16.0

On my Gem file I have:

ruby '2.4.2'

rmv list output:

ruby-2.3.5 [ x86_64 ]
=* ruby-2.4.2 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

回答1:


I finally solved it by doing:

sudo rm -rf _site
bundle update
bundle exec jekyll serve

And then always using bundle exec jekyll serve instead of sudo jekyll serve or jekyll serve.

I got this solution thanks to the answers in this post.



来源:https://stackoverflow.com/questions/47046746/jekyll-serve-error-cant-find-gem-jekyll-0-a-gemgemnotfoundexception

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!