0
votes

I am very new to ruby,so please help me out. I have two ruby versions installed on my machine one in /usr/bin/ruby and other in /usr/local/bin/ruby.When i am trying to run any bundler command like "/usr/local/bin/bundle exec " its not able to find the respective ruby and rake gems.My environment $PATH variable is "/sbin:/bin:/usr/sbin:/usr/bin:/opt/aws/bin:/usr/local/bin",but when i am running "/usr/local/bin/bundle env" i am getting following output Environment

Bundler   1.10.6
Rubygems  1.8.28
Ruby      2.2.5p319 (2016-04-26 revision 0) [x86_64-linux]
Git       2.7.4

Gemfile

# Passenger Version Gemfile
source "https://rubygems.org"

# gem "rails"
gem 'rack', '1.6.4'
gem 'passenger', '~>  4.0.59'

Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    daemon_controller (1.2.0)
    passenger (4.0.60)
      daemon_controller (>= 1.2.0)
      rack
      rake (>= 0.8.1)
    rack (1.6.4)
    rake (11.3.0)

PLATFORMS
  ruby

DEPENDENCIES
  passenger (~> 4.0.59)
  rack (= 1.6.4)

BUNDLED WITH
   1.10.6

but my bundle exec command is not able to find rake or ruby versions.Am i missing anything??

2
use rbenv. Learn more : misheska.com/blog/2013/06/15/… - Ninja Boy
Any particular reason you don't want to use RVM? Avoiding rbenv or RVM is more trouble than it's worth. - Sebastian

2 Answers

0
votes

Ruby, bundler, and gem all require a consistent set of paths and environment variables to locate the various scripts, binstubs, gemsets, and executables. RVM and rbenv have solved the problem of setting this up for each version for you. If you are determined, you can set up the environment yourself, but you'll need to learn what the authors of those version managers learned when they wrote the code. I use rbenv, and the docs do a good jobs of describing what rbenv does in maintaining a consistent environment for each installed ruby.

0
votes

Bundler is a gem and it get installed under one ruby version.

Use Rbenv or RVM to manage multiple ruby version in machine.