【问题标题】:Rails console - process finished with exit code 0Rails 控制台 - 进程以退出代码 0 结束
【发布时间】:2013-04-19 21:43:43
【问题描述】:

无法启动 rails 控制台。当我尝试启动它时,我收到了这条消息:

Loading development environment (Rails 3.2.12)
Process finished with exit code 0

它没有任何错误就退出。但是 rails server 启动没有问题:

=> Booting WEBrick
=> Rails 3.2.12 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2013-04-26 02:23:44] INFO  WEBrick 1.3.1
[2013-04-26 02:23:44] INFO  ruby 1.9.3 (2013-02-22) [x86_64-darwin12.2.0]
[2013-04-26 02:23:44] INFO  WEBrick::HTTPServer#start: pid=2393 port=3000

我正在使用 rvm 运行 Mac OS X。 为什么 Rails 控制台可能无法正常工作?

【问题讨论】:

  • 当你运行 ruby script/rails console 而不是 rails console 时会发生什么?
  • 没什么bash-3.2$ ruby script/rails consoleLoading development environment (Rails 3.2.12)bash-3.2$
  • 如果你从终端运行irb会发生什么?另外,rails 控制台是否可以在新的 rails 应用程序上运行?尝试运行rails new some_app,然后运行rails c
  • irb 运行正常。 rails new 可以毫无问题地创建新应用程序,但对于刚刚创建的应用程序,rails c 也遇到了同样的问题。我认为 rvm 有问题。尝试使用调试运行rails c
  • development.log 文件中还有更多信息吗?另外,当你 irb 时,开始从你的 environment.rb 文件中输入行,看看会发生什么。

标签: ruby-on-rails ruby-on-rails-3 ruby-on-rails-3.2 rails-console


【解决方案1】:

您尝试过使用 bundle exec 吗?

bundle exec rails c

【讨论】:

  • 什么也没发生bash-3.2$ bundle exec rails c Loading development environment (Rails 3.2.12) bash-3.2$
【解决方案2】:

如果您使用的是 RVM,请尝试使用 rvm implode 并重新安装 Ruby 和 Rails。

【讨论】:

  • 所以这是唯一的解决方案
猜你喜欢
  • 2017-01-19
  • 2015-05-23
  • 2018-05-29
  • 1970-01-01
  • 2021-02-20
  • 2014-01-04
  • 2017-11-03
  • 2020-01-04
  • 1970-01-01
相关资源
最近更新 更多