Reputation: 2244
I made the basic blog demo from a rails tutorial in a book from 2007. I realized it's dated so I deleted the blog I made and began to redo it from a tutorial here: http://guides.rubyonrails.org/getting_started.html#creating-the-blog-application
I started from scratch and now I'm stuck on 4.3 on that link's instructions because when I type in http://localhost:3000/
I keep getting the default screen for Rails instead of "Hello, Rails!" like the tut says I should.
The instructions on 4.3 are to type in
rm public/index.html
And then access the routes.rb file to uncomment the root to: section so that it says
root :to => "welcome#index"
I continued on with the migration and all that but I still keep getting the default screen.
Then I typed
rails server -d
to see if that does the trick but nope. It just says this only ending with the 2nd =>:
blog ❯ rails server -d
=> Booting WEBrick
=> Rails 3.2.3 application starting in development on http://0.0.0.0:3000
If I just type
rails server
I get an error in terminal that says the following:
blog ❯ rails server
=> Booting WEBrick
=> Rails 3.2.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-05-28 17:42:34] INFO WEBrick 1.3.1
[2012-05-28 17:42:34] INFO ruby 1.9.3 (2012-02-16) [x86_64-darwin11.3.0]
[2012-05-28 17:42:34] WARN TCPServer Error: Address already in use - bind(2)
Exiting
/Users/Nick/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/webrick/utils.rb:85:in `initialize': Address already in use - bind(2) (Errno::EADDRINUSE)
from /Users/Nick/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/webrick/utils.rb:85:in `new'
If anyone wants me to paste the rest of the error I'll go ahead and do that.
I'm not sure what to do from here to fix this.
Thanks for your help
Upvotes: 1
Views: 3309
Reputation: 270599
TCPServer Error: Address already in use - bind(2)
One of two things is happening:
The first time you did rails server -d
, you started a backgrounded WEBrick service that is eating port 3000. Find the running process and kill it via:
ps aux | grep ruby
kill [PID from above]
Then restart your WEBrick with just rails server
. At this point, having already removed the public/index.html, your route should be active and working.
Upvotes: 8