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?
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 .
lock . In general, you should use bundle install(1) to install the same exact gems and versions across machines. You would use bundle update to explicitly update the version of a gem.
What's the difference? A Gemfile. lock is auto-generated & it says exactly what versions of every gem were installed. Bundler will install these versions so when you deploy this application to production, or share your project with other developers, everyone will be working with an identical set of gems.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With