rails s hangs - Hartl Rails指南

时间:2014-01-04 04:40:06

标签: ruby-on-rails command-line

我是初学者,根据Hartl指南安装了我的系统(新版)上的所有内容。我遇到'rails s'的问题 - 它挂起并且没有继续,所以除了结束命令行进程并重新开始之外我无法做任何事情。这是它停止的地方:

$ rails s
=> Booting WEBrick
=> Rails 4.0.2 application starting in development on (localhost3000)
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2014-01-03 00:13:30] INFO  WEBrick 1.3.1
[2014-01-03 00:13:30] INFO  ruby 2.0.0 (2013-11-22) [x86_64-darwin13.0.0]
[2014-01-03 00:13:30] INFO  WEBrick::HTTPServer#start: pid=22805 port=3000


Started GET "/microposts/new" for 127.0.0.1 at 2014-01-03 00:13:38 -0800
  ActiveRecord::SchemaMigration Load (0.6ms)  SELECT "schema_migrations".* FROM "schema_migrations"
Processing by MicropostsController#new as HTML
[deprecated] I18n.enforce_available_locales will default to true in the future. If you really want to skip validation of your locale you can set I18n.enforce_available_locales = false to avoid this message.
  Rendered microposts/_form.html.erb (71.3ms)
  Rendered microposts/new.html.erb within layouts/application (90.6ms)
Completed 200 OK in 237ms (Views: 222.5ms | ActiveRecord: 0.4ms)


Started GET "/assets/users.css?body=1" for 127.0.0.1 at 2014-01-03 00:13:39 -0800


Started GET "/assets/microposts.css?body=1" for 127.0.0.1 at 2014-01-03 00:13:39 -0800


Started GET "/assets/scaffolds.css?body=1" for 127.0.0.1 at 2014-01-03 00:13:39 -0800


Started GET "/assets/users.js?body=1" for 127.0.0.1 at 2014-01-03 00:13:39 -0800


Started GET "/assets/turbolinks.js?body=1" for 127.0.0.1 at 2014-01-03 00:13:39 -0800


Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2014-01-03 00:13:39 -0800


Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2014-01-03 00:13:39 -0800


Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2014-01-03 00:13:39 -0800


Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2014-01-03 00:13:39 -0800


Started GET "/assets/microposts.js?body=1" for 127.0.0.1 at 2014-01-03 00:13:40 -0800


Started GET "/microposts/new" for 127.0.0.1 at 2014-01-03 00:19:11 -0800
Processing by MicropostsController#new as HTML
  Rendered microposts/_form.html.erb (6.1ms)
  Rendered microposts/new.html.erb within layouts/application (8.0ms)
Completed 200 OK in 19ms (Views: 17.9ms | ActiveRecord: 0.0ms)


Started GET "/assets/scaffolds.css?body=1" for 127.0.0.1 at 2014-01-03 00:19:12 -0800


Started GET "/assets/turbolinks.js?body=1" for 127.0.0.1 at 2014-01-03 00:19:12 -0800


Started GET "/assets/application.css?body=1" for 127.0.0.1 at 2014-01-03 00:19:12 -0800


Started GET "/assets/microposts.js?body=1" for 127.0.0.1 at 2014-01-03 00:19:12 -0800


Started GET "/assets/users.css?body=1" for 127.0.0.1 at 2014-01-03 00:19:12 -0800


Started GET "/assets/jquery.js?body=1" for 127.0.0.1 at 2014-01-03 00:19:12 -0800


Started GET "/assets/jquery_ujs.js?body=1" for 127.0.0.1 at 2014-01-03 00:19:12 -0800


Started GET "/assets/microposts.css?body=1" for 127.0.0.1 at 2014-01-03 00:19:12 -0800


Started GET "/assets/users.js?body=1" for 127.0.0.1 at 2014-01-03 00:19:12 -0800


Started GET "/assets/application.js?body=1" for 127.0.0.1 at 2014-01-03 00:19:12 -0800

3 个答案:

答案 0 :(得分:1)

如上所述,rails服务器在您运行时接管终端。你必须开始一个新的终端会议。 ubuntu / linux中的退出步骤是组合

 CTL+SHIFT+T

CTL+ALT+T

答案 1 :(得分:0)

当您运行“rails s”时,它会接管终端并且不会返回。如果要同时运行其他命令,则应打开第二个终端。

在制作中,您通常使用apache或nginx设置rails。有关详细信息,请参阅本指南:

http://rubyonrails.org/deploy

答案 2 :(得分:0)

我最初有同样的问题。它看起来像悬挂但实际上意味着它正在运行。只要看起来它正在运行服务器,您就可以打开localhost:3000来在本地查看您的网页。当您准备关闭服务器并获得提示时,您可以单击Mac上的控制c。