AnnaL
AnnaL

Reputation: 121

Rails server command is hanging

Could someone please help with my issue? I'm novice at Ruby on rails... I just created a new application by running rails new my_app, then I went to cd my_app and tried to run rails server by running rails server command. My output is:

C:\Users\Cama\my_app>rails s
=> Booting WEBrick
=> Rails 4.1.0 application starting in development on http://0.0.0.0:3000
=> 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
[2014-04-15 20:54:14] INFO  WEBrick 1.3.1
[2014-04-15 20:54:14] INFO  ruby 2.0.0 (2013-06-27) [i386-mingw32]
[2014-04-15 20:54:14] INFO  WEBrick::HTTPServer#start: pid=5172 port=3000

And I've been waiting for 20 minutes and nothing happened.

What could be my problem?

Thank you, Cama

Upvotes: 1

Views: 2232

Answers (2)

stevec
stevec

Reputation: 52218

Same problem, different reason. I had a weird case where one of my ruby gems was trying to start a (weird, and unrelated) process. When it couldn't find the program it was after, it just stalled and both rails s and rails c hung indefinitely.

I could tell it was the gem because when I'd ctrl + c to stop the server it would error and the last line was

/Users/st/.rbenv/versions/2.7.1/lib/ruby/gems/2.7.0/bundler/gems/rinruby-3db385cbda91/lib/rinruby.rb:537:in `write'

which showed me it was the rinruby trying to start R.

Although this is quite a specific answer, the same idea my apply to yourself or others: if a gem or another process is trying to do something very lengthy (or which has hung), it may cause the server to hang.

Upvotes: 0

Kirti Thorat
Kirti Thorat

Reputation: 53018

WEBrick Server started successfully. You won't see anything on the terminal until you go and access your web application in browser.

Just open a web browser say Google Chrome and type http://0.0.0.0:3000 in the address bar and hit enter. You should be able to see your rails application.

By default, Rails will bind WEBrick server with Default: 0.0.0.0. You could change the binding to other ip address by issuing following command:

rails server -b your_ip_address

Now your application will run on given ip.

Upvotes: 2

Related Questions