Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bundle doesn't want to install a gem (not yet checked out)

I want to run a Ruby on rails server, but a certain gem doesn't want to install. This rails program is not compatible with ruby 2.0, so I want to use ruby 1.9.3, which I installed, but I can't bundle install anymore...

$ bundle install
# ...
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
$ bundle exec rails s
git://github.com/goodtouch/jbuilder.git (at master) is not yet checked out. Run `bundle install` first.
$ bundle show jbuilder
/Users/julien/.bundler/ruby/2.0.0/jbuilder-7fb0eae924c7
$ ruby --version
ruby 1.9.3p545 (2014-02-24 revision 45159) [x86_64-darwin13.1.0]

In the Gemfile, I specified ruby "1.9.3", then I ran bundle install again and got:

Your Ruby version is 2.0.0, but your Gemfile specified 1.9.3

The Gemfile line for this specific gem:

gem 'jbuilder', git: "git://github.com/goodtouch/jbuilder.git"

And what I get in the Gemfile.lock:

GIT
  remote: git://github.com/goodtouch/jbuilder.git
  revision: 7fb0eae924c77318ede344f32a5c208b91cdbaac
  specs:
    jbuilder (0.4.1)
      activesupport (>= 3.0.0)
      blankslate (>= 2.1.2.4)

I really don't understand what's going on. I'm under Mac OS X.

Thank you.

like image 923
Julien Fouilhé Avatar asked Mar 21 '14 09:03

Julien Fouilhé


People also ask

How do I fix a run bundle to install missing gems?

Select Tools | Bundler | Install from the main menu. Open the Gemfile, place the caret at any highlighted gem missing in the project SDK and press Alt+Enter . Select Install missing gems using 'bundler' and press Enter .

How do you add a bundle gem?

Specify the group(s) for the added gem. Multiple groups should be separated by commas. Specify the source for the added gem. Adds require path to gem.

What is bundle installation?

So bundle install command will install all gems to the system that are listed in Gemfile as well as their dependencies. If the gem was not previously installed it will grab it from the gemcutter repo. bundle package will cache the . gem files into your apps vendor/cache directory. No need to run gem install first.


1 Answers

Edit: You have to use rvm or rbenv to set ruby version. This is not set in the gem file. Ruby is not a gem.

This error might have one of many reasons.

From the Bundler issues

# remove user-specific gems and git repos
rm -rf ~/.bundle/ ~/.gem/bundler/ ~/.gems/cache/bundler/

# remove system-wide git repos and git checkouts
rm -rf $GEM_HOME/bundler/ $GEM_HOME/cache/bundler/

# remove project-specific settings
rm -rf .bundle/

# remove project-specific cached gems and repos
rm -rf vendor/cache/

# remove the saved resolve of the Gemfile
rm -rf Gemfile.lock

# uninstall the rubygems-bundler and open_gem gems
rvm gemset use global # if using rvm
gem uninstall rubygems-bundler open_gem

# try to install one more time
bundle install
like image 148
Andreas Lyngstad Avatar answered Oct 28 '22 09:10

Andreas Lyngstad