Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k views
in Technique[技术] by (71.8m points)

ruby - find_spec_for_exe': can't find gem bundler (>= 0.a) (Gem::GemNotFoundException)

I used sudo bundle install and that might be the cause of the issue?

Now I have:

  • gem -v 2.6.14
  • ruby -v ruby 2.3.5p376 (2017-09-14 revision 59905) [x86_64-darwin15]
  • jekyll -v jekyll 3.6.2
  • bundle -vBundler version 1.16.0.pre.3

I'm getting the following error when trying to run bundle exec jekyll serve or just jekyll serve

/Users/myusername/.rvm/rubies/ruby-2.3.5/lib/ruby/site_ruby/2.3.0/rubygems.rb:271:in `find_spec_for_exe': can't find gem bundler (>= 0.a) (Gem::GemNotFoundException)
    from /Users/myusername/.rvm/rubies/ruby-2.3.5/lib/ruby/site_ruby/2.3.0/rubygems.rb:299:in `activate_bin_path'
    from /Users/myusername/.rvm/gems/ruby-2.3.5/bin/bundle:23:in `<main>'
    from /Users/myusername/.rvm/gems/ruby-2.3.5/bin/ruby_executable_hooks:15:in `eval'
    from /Users/myusername/.rvm/gems/ruby-2.3.5/bin/ruby_executable_hooks:15:in `<MacBooMacBook-MacBook-MacBook-Pro-MacBook-PrMacBook-MacBooMacBMaMacBMaMaMaMaMaMaMaMaMacBMaMaMaMacBMa

Also, when accessing the folder in which I have my blog cd my_path I get the following message:

VM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too, you can ignore these warnings with 'rvm rvmrc warning ignore /Library/WebServer/Documents/blog/Gemfile'. To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'. Unknown ruby interpreter version (do not know how to handle): RUBY_VERSION.

I've no idea how to solve this. I just want to create my static blog and honestly I have no idea about Ruby, Gem or Bundle :) So I would appreciate some insights!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The problem in my case is that the Gemfile.lock file had a BUNDLED_WITH version of 1.16.1 and gem install bundler installed version 2.0.1, so there was a version mismatch when looking to right the folder

gem install bundler -v 1.16.1 fixed it

Of course, you can also change your Gemfile.lock's BUNDLED_WITH with last bundler version and use recent software, as Sam3000 suggests


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...