Chris Bolton
Chris Bolton

Reputation: 2926

Bundle install broken on ruby 2.0 upgrade

Just upgraded to ruby 2.0/rails 4.0 and trying to run bundle install on a new rails project. Whenever it hits something that's not already installed, it'll spit out:

Installing coffee-rails (4.0.0.beta1) 
Errno::ENOENT: No such file or directory - /usr/lib/ruby/gems/2.0.0/build_info/coffee-rails-4.0.0.beta1.info
An error occurred while installing coffee-rails (4.0.0.beta1), and Bundler cannot continue.
Make sure that `gem install coffee-rails -v '4.0.0.beta1'` succeeds before bundling.

So then I then run

gem install coffee-rails -v '4.0.0.beta1'

And it installs fine, and I rerun bundle install and have to repeat this for every time it runs into a gem version I haven't installed yet. What's the problem here?

Upvotes: 12

Views: 2826

Answers (4)

razzintown
razzintown

Reputation: 188

This solved it for me:

sudo gem update --system --no-user-install

source: https://bbs.archlinux.org/viewtopic.php?id=138650

Upvotes: 3

kyku
kyku

Reputation: 6042

In my case it turned out that bundle was trying to install gems into global location at /usr/lib/ruby/gems/2.0.0, but since I didn't invoke it through sudo it ended up with permission error. I wanted to install to my home dir anyhow so it turned out that I can do:

GEM_HOME=~/.gem/ruby/2.0.0/ bundle

and live happily ever after.

Upvotes: 8

smathy
smathy

Reputation: 27961

The bundle executable is just a shell script, and it has a shebang line which will be pointing to a particular Ruby executable (or to /usr/bin/env ruby). It sounds like that shebang line is pointing to a different version of Ruby, not the 2.0 one, and not the one that the shebang line in your gem executable is pointing to.

Run this to see what it's pointing to: head -1 $(which bundle)

Whatever line that shows you, strip off the #! prefix and run that line with the -v switch to see which version of Ruby it is (if it's not obvious). So if the shebang line was #!/usr/bin/ruby then run /usr/bin/ruby -v If my theory is correct then you'll get a non 2.0 version number there.

Based on what you said, your gem executable is pointing to the 2.0 Ruby, so the fix here is to just uninstall and then reinstalled the bundler gem. That should put the right Ruby 2.0 shebang line into your bundle executable.

Upvotes: 4

Brian Petro
Brian Petro

Reputation: 1567

Put this in your Gemfile and then run bundle install.

group :assets do
  gem 'coffee-rails', github: 'rails/coffee-rails'
end

Upvotes: 0

Related Questions