Problems getting WEBrick server up and running (new to ruby)

Hello,

I installed ruby and rails on Monday as I have been hearing great things
about both the ruby language and rails framework.

Installation went smoothly but I am having problems launching a WEBrick
server so see what my newly created rails app is doing!

My ruby/ rails installation:

  1. Installed ruby directly by compiling the source code.
  2. Working on a windows pc, using cygwin to run / compile etc.
  3. Ruby appears to be installed correctly and I have been able to
    successfully run code.
  4. Rails installed through ruby gems.
  5. Rails appears to be installed correctly i.e. running rails testapp
    ins cygwin creates all the expected directories for a testapp
    application.
  6. Using MySQL to create databases, appears to be installed correctly I
    can run SQL from the cygwin command line, create databases tables etc.
  7. Created the appropriate databases for the apps and info matches up
    with database config file.

Problem:

When I try and start a WEBrick server

i.e. navigate to testApp directory in cygwin and run â??ruby
./script/serverâ??

it just hangs. There is no output to the screen and I cannot connect to
http://localhost:3000.

I am pretty sure this is nothing to with the testApp itself as if I
create a clean rails application and try and start the web server the
same thing happens.

Has anyone experienced a problem similar to this or have any advice?

Thanks in advance for any replies.

Matt.

P.S
You can ssume my technical skill is low, not only am I new to ruby and
rails, Iâ??m pretty new to programming in general. I am quite capable of
following instructions however!

You may want to try the ruby one-click installer:
http://rubyinstaller.rubyforge.org/wiki/wiki.pl

What happens if you press Ctrl-C in the console where you started
WEBrick? I had a case where this would then start the server correctly
after seemingly hanging.

Max

Max M. wrote:

You may want to try the ruby one-click installer:
http://rubyinstaller.rubyforge.org/wiki/wiki.pl

What happens if you press Ctrl-C in the console where you started
WEBrick? I had a case where this would then start the server correctly
after seemingly hanging.

Max

Hi Max,

Thanks for the reply,

Both crtl-c and ctrl-d fail to exit after hanging. The console does not
seem to respond to any commands. Do you think it is worth me trying to
reinstall ruby by compiling the src code again? Could I have installed
the WEBrick portion incorrectly?

I’d like to get familiar with the installing from src code procedure so
I would prefer to use the compiling from src install method rather than
the one-click method.

Cheers,

Matt.

I’d try the one-click method first, to see if it is a problem with
your system setup somehow. If that does work, you’ll know you have a
problem with your compile procedure.

In my experience, unless you want to run the very latest bleeding-edge
version of Ruby (which I would not recommend anyway), you will not
need to compile Ruby. Ever. There are precompiled packages out there
for almost every environment. There is no benefit in compiling Ruby
yourself.

If you really want to get familiar with building packages from source,
I recommend picking a different target (for example Lighttpd).

Cheers,
Max

I ran into exactly the same problem when using Ruby as installed by the
Cygwin environment. Here is what worked for me – it may or may not
work for you as you compiled Ruby yourself…

ruby script/server webrick

This forces it to try to use webrick instead of lighhtpd – I had
assumed that it would default to webrick but apparently this is not the
case due to something weird going on with Cygwin. It tries to evaluate
lighhtpd -version deep down in the library, which is apparently
hanging. By specifying webrick directly on the command line, this step
is bypassed, and I was able to get webrick up and running.

Hope this helps.
-C.

Thanks for the solution! I had the same problem and now it works!

Matt G. wrote:

When I try and start a WEBrick server

i.e. navigate to testApp directory in cygwin and run â??ruby
./script/serverâ??

it just hangs. There is no output to the screen and I cannot connect to
http://localhost:3000.

I ran into exactly the same problem when using Ruby as installed by the
Cygwin environment. Here is what worked for me – it may or may not
work for you as you compiled Ruby yourself…

ruby script/server webrick

This forces it to try to use webrick instead of lighhtpd – I had
assumed that it would default to webrick but apparently this is not the
case due to something weird going on with Cygwin. It tries to evaluate
lighhtpd -version deep down in the library, which is apparently
hanging. By specifying webrick directly on the command line, this step
is bypassed, and I was able to get webrick up and running.

Hope this helps.
-C.