【问题标题】:Cannot run RoR site on Cloud9 due to ruby version error由于 ruby​​ 版本错误,无法在 Cloud9 上运行 RoR 站点
【发布时间】:2015-04-03 14:08:22
【问题描述】:

在本文底部发现的错误日志

我已关注this 教程系列,了解如何在 Cloud9 上制作 Ruby on Rails 应用程序,但遇到了障碍。

我到了可以通过 Cloud9 将代码部署到 Heroku 服务器的部分。为了做到这一点,教程的人建议将 Ruby 版本从默认的 2.1.5 更改为 2.1.4

部署顺利,网站在 Heroku 上运行良好,但现在我失去了在 Cloud9 上运行它的能力。请注意,我的 bash_profile 文件包含以下命令:

rvm use 2.1.4
source ~/.profile

任何想法为什么我会遇到这个问题?

日志:

Warning! PATH is not properly set up, '/usr/local/rvm/gems/ruby-2.1.4/bin' is not at first place,                                             
         usually this is caused by shell initialization files - check them for 'PATH=...' entries,                                            
         it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',                                                 
         to fix temporarily in this shell session run: 'rvm use ruby-2.1.4'.                                                                  
Using /usr/local/rvm/gems/ruby-2.1.4                                                                                                          
Your code is running at https://foosite-foouser.c9.io.                                                                                 

Warning! PATH is not properly set up, '/usr/local/rvm/gems/ruby-2.1.4/bin' is not at first place,                                             
         usually this is caused by shell initialization files - check them for 'PATH=...' entries,                                            
         it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',                                                 
         to fix temporarily in this shell session run: 'rvm use ruby-2.1.4'.                                                                  
Using /usr/local/rvm/gems/ruby-2.1.4                                                                                                          
Your Ruby version is 2.1.5, but your Gemfile specified 2.1.4 

更新

rvm 列表输出:

foouser@foosite:~/workspace (master) $ rvm list

rvm rubies

   ruby-1.8.7-p374 [ x86_64 ]
   ruby-1.9.3-p547 [ x86_64 ]
=* ruby-2.1.4 [ x86_64 ]
   ruby-2.1.5 [ x86_64 ]

# => - current
# =* - current && default

更新 2

运行rails s -b $IP -p $PORT的输出

=> Booting WEBrick
=> Rails 4.1.6 application starting in development on http://0.0.0.0:8080
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
[2015-04-17 21:29:28] INFO  WEBrick 1.3.1
[2015-04-17 21:29:28] INFO  ruby 2.1.4 (2014-10-27) [x86_64-linux]
[2015-04-17 21:29:28] INFO  WEBrick::HTTPServer#start: pid=2626 port=8080

【问题讨论】:

  • 你安装了 ruby​​ 2.1.4 吗?在命令行上运行rvm list 的输出是什么?
  • 如果您使用的是 Rails 运行器,它默认为 2.1.5@rails4,可能会导致问题。可以试试在命令行运行rails s -b $IP -p $PORT,看看输出是不是一样?
  • 非常抱歉回复晚了。在我的问题中添加了输出。
  • 那么,如果你通过命令行运行rails就可以了?
  • 是的,确实如此。有没有办法可以配置 IDE 来做同样的事情?

标签: ruby-on-rails ruby cloud9-ide


【解决方案1】:

根据 Mutahhir 的建议,将 rails runner 配置为 2.1.4

【讨论】:

    猜你喜欢
    • 2016-05-21
    • 1970-01-01
    • 2023-03-10
    • 2020-09-27
    • 1970-01-01
    • 2019-08-20
    • 1970-01-01
    • 2021-03-31
    • 1970-01-01
    相关资源
    最近更新 更多