Jekyll serve error: can't find gem jekyll (>= 0.a) (Gem::GemNotFoundException
Jekyll serve error: can't find gem jekyll (>= 0.a) (Gem::GemNotFoundException
在执行 sudo jekyll serve
时出现以下错误:
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>'
如果有帮助:
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
在我的 Gem 文件中我有:
ruby '2.4.2'
rmv list
输出:
ruby-2.3.5 [ x86_64 ]
=* ruby-2.4.2 [ x86_64 ]
# => - current
# =* - current && default
# * - default
我终于解决了这个问题:
sudo rm -rf _site
bundle update
bundle exec jekyll serve
然后总是使用 bundle exec jekyll serve
而不是 sudo jekyll serve
或 jekyll serve
。
感谢 in this post 的回答,我得到了这个解决方案。
在执行 sudo jekyll serve
时出现以下错误:
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>'
如果有帮助:
jekyll -v
returnsjekyll 3.6.2
ruby -v
returnsruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin15]
gem -v
returns2.6.14
bundle -v
returnsBundler version 1.16.0
在我的 Gem 文件中我有:
ruby '2.4.2'
rmv list
输出:
ruby-2.3.5 [ x86_64 ]
=* ruby-2.4.2 [ x86_64 ]
# => - current
# =* - current && default
# * - default
我终于解决了这个问题:
sudo rm -rf _site
bundle update
bundle exec jekyll serve
然后总是使用 bundle exec jekyll serve
而不是 sudo jekyll serve
或 jekyll serve
。
感谢 in this post 的回答,我得到了这个解决方案。