Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails bundle - bad interpreter

Tags:

I've been working on a rails project in sublime text and switched to rubymine. It said that some gems, which are required in the project, are not installed. Well, I tried to install them, but it fails with an error saying that the used ruby version is another than the version specified in the gem file.

When I enter ruby -v, it looked like the same version. I've then tried to reinstall the ruby version (2.0.0) and as that didn't lead to success, I've installed 2.1.0 hoping it would set the correct path and everything.

When I now try to enter bundle, I get the following error:

bash: /Users/user/.rvm/gems/ruby-2.0.0-p353/bin/bundle: /Users/user/.rvm/rubies/ruby-2.1.0/bin/ruby: bad interpreter: No such file or directory

Version 2.1.0 is not even installed anymore. I've searched for solutions for a long time but nothing really worked in my case. How would you fix this error? As far as I understand I understand the problem and the answers I've read, some kind of link to a path, used by the bundle command, is set wrong?

I'm using rvm for ruby the versions.

ruby -v says `ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-darwin12.5.0]

rvm listsays

   ruby-1.9.2-p320 [ x86_64 ]
   ruby-1.9.3-p0 [ x86_64 ]
   ruby-1.9.3-p392 [ x86_64 ]
   ruby-1.9.3-p448 [ x86_64 ]
   ruby-2.0.0-p0 [ x86_64 ]
   ruby-2.0.0-p247 [ x86_64 ]
=* ruby-2.0.0-p353 [ x86_64 ]
like image 674
Linus Avatar asked Jan 15 '14 17:01

Linus


Video Answer


2 Answers

You should run:

gem install bundler

after reinstalling ruby and point of note, your version of ruby should be same as that in the Gemfile

like image 133
bjhaid Avatar answered Oct 11 '22 10:10

bjhaid


For me the problem was happening because I had installed 2 versions of Ruby, and after deleted one of them. The console was trying to get the deleted version of ruby.

The solution was: Remove the old version from the environment vars.

Observation: I'm using Windows 10.

like image 30
Herlon Aguiar Avatar answered Oct 11 '22 09:10

Herlon Aguiar