4

while i was trying to run this code "bundle install --without production" I am getting an error like "The program 'bundle' is currently not installed. You can install it by typing: sudo apt-get install ruby-bundler " I have installed bundle already but still getting this error.

This problem occurred while i was learning from Harlt's.."Updating Gemfile" at Heroku setup section

Abhinay
  • 1,796
  • 4
  • 28
  • 52
  • 5
    does `gem install bundler` help? – tessi Sep 19 '13 at 14:29
  • 1
    @tessi Yes,I have installed bundler through this command..but still getting the same response – Abhinay Sep 19 '13 at 14:36
  • are you using rvm? there might be a conflict between ruby versions. – Miotsu Sep 19 '13 at 14:38
  • @Miotsu Yes i am using rvm ..but there is only one version of ruby(ruby 2.0.0p247) – Abhinay Sep 19 '13 at 14:40
  • 4
    If you've installed Ruby through rbenv you might need to run `rbenv rehash` to make it work. – Eifion Sep 19 '13 at 14:41
  • @Eifion No, I have installed ruby using rvm – Abhinay Sep 19 '13 at 14:45
  • @Eifion Thank you guys..I have resolved my problem accidently but still its beyond my understanding..I have only one version of ruby(ruby 2.0.0) and at the starting of installation i have run this command "rvm use 2.0.0" and again at this point i have done the same and it solves my problem i really don't know how and why..but now "bundle install -without production" command is working.thank a lot mates – Abhinay Sep 19 '13 at 15:32
  • The error is because you have to tell rvm which ruby is your default, unless you do this you don't are using ruby 2.0 always, to definitely fix the problem ```rvm use 2.0.0 --default``` – rderoldan1 Sep 19 '13 at 22:26
  • @rderoldan1 I have one more issue like.whenever i close command prompt after that if i want to again start working on rails..then before i have to run this command /bin/bash --login and after this command only i can able to use rvm or gem or bundle command..can you suggest some solution to this problem – Abhinay Sep 20 '13 at 03:54
  • The problem is there after `rvm use 2.0.0 --default`, if you only run the use command, your OS use this ruby in your terminal session – rderoldan1 Sep 20 '13 at 14:56
  • @SandipMondal Thanks to you Now i am getting a new error -:command not found continuously ..please don't give this advice to others..it has created problems for many..cd rails_projects –: command not found –: command not found –: command not found this what i get after executing the command suggested by you..and now i am not able run even a single command in my Terminal – Abhinay Sep 22 '13 at 18:58

2 Answers2

9

First Set up the PATH variable for the installed ruby executable(Suppose the installed ruby is ruby-2.0.0-p451):

PATH=$PATH:$HOME/.rvm/gems/ruby-2.0.0-p451/bin

and then run,

gem install bundler (if bundler is not installed)

and lastly run,

rvm use ruby-2.0.0-p451 --default (--default is optional).

There you go. Now you would be able to run bundle command with out any issues.

Hope it helps :)

Rajesh Omanakuttan
  • 6,788
  • 7
  • 47
  • 85
  • 2
    I had a similar problem. I did have bundler installed, but it was not setup in my PATH variable. Quickly adding the right path in my .bashrc solved the issue. – mrfred Jul 16 '15 at 21:56
4

For those, who uses rbenv receipt is:

gem install bundler
rbenv rehash
bundle
Daniel Garmoshka
  • 5,849
  • 39
  • 40