0

First-time Ruby user here, and Jekyll is the reason.

First, I installed RVM (on Ubuntu Server 12.04 64-bit):

\curl -L https://get.rvm.io | bash -s stable

And followed the subsequent instructions as guided by the installation process (for e.g. adding source ~/.profile to ~/.bash_profile). The FULL INSTRUCTIONS I followed are here.

Read output of rvm requirements command, and installed all the necessary binaries.

Installed Ruby 1.9.3, configured RVM to use it, and then installed RubyGems, by issuing the following command one after the other:

rvm install 1.9.3
rvm use 1.9.3
rvm rubygems current

Ran ruby --version to be sure I'm using Ruby 1.9.3.

Then installed Jekyll using the gem:

gem install jekyll

Setup the basic site structure by copying the contents of jekyll/site provided by the official Jekyll repository, then made the necessary changes to _config.yml and CNAME.

Here's the thing! When I run jekyll --server I get the same old TCP/Webrick error (but none of the solutions work).

So, as the Jekyll wiki says, it's probably this:

On Debian or Ubuntu, you may need to add /var/lib/gems/1.8/bin/ to your path.

The problem is:

  1. In my case, /var/lib/gems/... doesn't exist. Probably because I installed Ruby, RubyGems, all using RVM. So, what'd be the path in my case?

  2. Again, if I know the path, how am I supposed to "to add /var/lib/gems/*.*/bin/ to your path"?

Community
  • 1
  • 1
its_me
  • 10,998
  • 25
  • 82
  • 130

1 Answers1

1

First of all, you can just ignore this problem, if you mean

[2012-04-21 13:46:40] WARN  TCPServer Error: Address already in use - bind(2)

It's because some buggy code in latest version of jekyll on RubyGems, however, it seems to have been corrected in the latest code on github. The server created by jekyll tries to bind on both IPv4('0.0.0.0') and IPv6('::'), so the first bind succeeds and the bind on IPv6 fails and an warning is logged.

Take a look at the jekyll executable in your ~/.rvm directory, maybe ~/.rvm/gems/ruby-1.9.3-p392/gems/jekyll-0.12.1/bin/jekyll, at about line 288:

s = HTTPServer.new(
  :Port            => options['server_port'],
  :MimeTypes       => mime_types
)

Here HTTPServer is WEBrick::HTTPServer. jekyll creates the server without specifying :BindAddress configuration. And the bind address is set to nil as default.

WEBrick will call Socket.getaddrinfo to get the real addresses from the bind address specified, which, when passed in a nil address, returns wildcard address for both IPv4('0.0.0.0') and IPv6('::'). Later, WEBrick calls TCPServer.new(address, port) to create TCPServer. And this is where the TCPServer Error arises.

For more details, read WEBrick::Utils.create_listeners

Arie Xiao
  • 13,909
  • 3
  • 31
  • 30
  • You may be right, but I just figured that adding `server: false` in my _config.yml fixed it. Any idea why? It works now, but I really want to know why. – its_me Mar 25 '13 at 16:41
  • @TheoneManis it doesn't make sense. Command line options has higher precedence than the configuration file `_config.yml`. If you specify `--server` command line option, the configuration entry `server: false` will have no effect. – Arie Xiao Mar 25 '13 at 16:52
  • Okay. Then I create an issue on Jekyll github repo and see if I can get some info (and report back here). – its_me Mar 25 '13 at 16:53
  • @TheoneManis It seems that they have fixed the issue in the latest source code. Although RubyGems still uses buggy version. – Arie Xiao Mar 25 '13 at 16:58