Alvaro
Alvaro

Reputation: 41595

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

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:

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

Upvotes: 7

Views: 5373

Answers (1)

Alvaro
Alvaro

Reputation: 41595

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.

Upvotes: 6

Related Questions