rails c抛出错误bin_path':无法找到rails-3.2.8的可执行rails(Gem :: Exception)

时间:2015-12-07 09:18:17

标签: ruby-on-rails ruby linux ruby-on-rails-3 gem

我正在尝试在生产模式下打开rails控制台,它会抛出错误,

$start=strtotime("08:30");
$end=strtotime("17:30");
$startLunch=strtotime("12:00");
$endLunch=strtotime("13:00");
$now = $start;
// and then you can use it in your while loop:
while($now <= $end){
    if($now < $startLunch || $now > $endLunch)
    {
        echo '<option value="'.date("H:i",$now).':00">'.date("H:i",$now).'</option>';
    }
    $now = strtotime('+10 minutes',$now);
}

我没有用过rvm。其他命令如/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>' 正常运行。 rake:xyz的输出如下,

RubyGems环境:

  • RUBYGEMS版本:1.3.7
  • RUBY VERSION:1.9.2(2011-07-09 patchlevel 290)[x86_64-linux]
  • 安装目录:/usr/local/lib/ruby/gems/1.9.1
  • RUBY EXECUTABLE:/ usr / local / bin / ruby​​
  • EXECUTABLE目录:/ usr / local / bin
  • RUBYGEMS PLATFORMS:
    • 红宝石
    • x86_64的Linux的
  • GEM路径:
    • /usr/local/lib/ruby/gems/1.9.1
    • /root/.gem/ruby/1.9.1
  • GEM配置:
    • :update_sources =&gt;真
    • :verbose =&gt;真
    • :benchmark =&gt;假
    • :backtrace =&gt;假
    • :bulk_threshold =&gt; 1000
  • 远程来源:

请让我知道需要什么。我不能把它作为生产环境进行捆绑安装等,并且运行的任务很少。我不想破坏现有的任务/流程

2 个答案:

答案 0 :(得分:1)

通过使用,

工作

RAILS_ENV =生产包exec rails c

答案 1 :(得分:0)

作为初学者,我在我的系统上尝试了同样的操作,然后进入了rails控制台。实际上我的gem env导致了

    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/

在阅读错误时,发现宝石已过时。解决这个问题的最佳方法是将gem更新为最新版本。如果需要帮助,请查看此http://www.coval.nl/blog/?p=18