0
votes

I am trying to open rails console in production mode and it throws below error,

/usr/local/lib/ruby/1.9.1/rubygems.rb:340:in `bin_path': 
    can't find executable rails for rails-3.2.8 (Gem::Exception)
    from /usr/local/bin/rails:19:in `<main>'

I have not used rvm. Other commands like rake:xyz runs properly. Output of $gem env is as follows,

RubyGems Environment:

  • RUBYGEMS VERSION: 1.3.7
  • RUBY VERSION: 1.9.2 (2011-07-09 patchlevel 290) [x86_64-linux]
  • INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.9.1
  • RUBY EXECUTABLE: /usr/local/bin/ruby
  • EXECUTABLE DIRECTORY: /usr/local/bin
  • RUBYGEMS PLATFORMS:
    • ruby
    • x86_64-linux
  • GEM PATHS:
    • /usr/local/lib/ruby/gems/1.9.1
    • /root/.gem/ruby/1.9.1
  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :benchmark => false
    • :backtrace => false
    • :bulk_threshold => 1000
  • REMOTE SOURCES:

Please let me know what needs to be. I cannot go for bundle install, etc as its production env and there are few tasks running. I dont want to break existing tasks / processes

2
Looks like you don't have rails installed.Yevgeniy Anfilofyev
It Worked...had to use RAILS_ENV=production bundle exec rails cSachin Kadam

2 Answers

1
votes

It worked by using,

RAILS_ENV=production bundle exec rails c

0
votes

Being a beginner,I have tried the same on my system and I got into the rails console.In fact my gem env resulted in

    RubyGems Environment:
    - RUBYGEMS VERSION: 1.8.23
    - RUBY VERSION: 1.9.3 (2013-11-22 patchlevel 484) [x86_64-linux]
    - INSTALLATION DIRECTORY: /var/lib/gems/1.9.1
    - RUBY EXECUTABLE: /usr/bin/ruby1.9.1
    - EXECUTABLE DIRECTORY: /usr/local/bin
    - RUBYGEMS PLATFORMS:
      - ruby
      - x86_64-linux
    - GEM PATHS:
       - /var/lib/gems/1.9.1
       - /home/mmohan/.gem/ruby/1.9.1
    - GEM CONFIGURATION:
       - :update_sources => true
       - :verbose => true
       - :benchmark => false
       - :backtrace => false
       - :bulk_threshold => 1000
    - REMOTE SOURCES:
       - http://rubygems.org/

On reading the error, gem is found to be outdated. The best method to tackle it is by updating gem to latest one. If for assistance, check thishttp://www.coval.nl/blog/?p=18