A long time I have not been using Ruby On Rails. I have decided to give it a try again, so started by installing on Ubuntu 11.10 in VirtualBox. From what I remember - I have never happened before having issue with RoR working out of the box. Unfortunately this was not the case this time. Everything started with something really new to me:

Invalid gemspec in [/var/lib/gems/1.8/specifications/json-1.6.1.gemspec]: invalid date format in specification: "2011-09-18 00:00:00.000000000Z"

Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"

Invalid gemspec in [/var/lib/gems/1.8/specifications/json-1.6.1.gemspec]: invalid date format in specification: "2011-09-18 00:00:00.000000000Z"

Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"

At the beginning I have tried to solve it in several ways - by installing ruby from APT sources via

sudo apt-get install rails

or just by installing rails from gems:

sudo gem install rails

Both re-installation and methods did not worked.

So I have to dig deeper.

After a lot of searching in google I found a simple solution. Obviously gemspecs have some different date formats that don’t validate. **So if you have such a message, just run the following command:

**

sudo sed -i 's/ 00:00:00.000000000Z//' /var/lib/gems/1.8/specifications/*

This will fix the message. As soon as you install some new gem and you have this message - just run the script again.

Next it came the problem with SQLIte3:

Building native extensions.  This could take a while...
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite3-devel' and check your shared library search path (the
location where your sqlite3 shared library is located).
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

This is solved by installing the development package of SQLite Ruby:

sudo apt-get install libsqlite3-dev

And at the end it came the problem with missing ExecJS engine:

A long time I have not been using Ruby On Rails. I have decided to give it a try again, so started by installing on Ubuntu 11.10 in VirtualBox. From what I remember - I have never happened before having issue with RoR working out of the box. Unfortunately this was not the case this time. Everything started with something really new to me:

Invalid gemspec in [/var/lib/gems/1.8/specifications/json-1.6.1.gemspec]: invalid date format in specification: "2011-09-18 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/json-1.6.1.gemspec]: invalid date format in specification: "2011-09-18 00:00:00.000000000Z"
Invalid gemspec in [/var/lib/gems/1.8/specifications/tilt-1.3.3.gemspec]: invalid date format in specification: "2011-08-25 00:00:00.000000000Z"

At the beginning I have tried to solve it in several ways - by installing ruby from APT sources via

sudo apt-get install rails

or just by installing rails from gems:

sudo gem install rails

Both re-installation and methods did not worked.

So I have to dig deeper.

After a lot of searching in google I found a simple solution. Obviously gemspecs have some different date formats that don’t validate. If you have such a message, just run the following command:

sudo sed -i 's/ 00:00:00.000000000Z//' /var/lib/gems/1.8/specifications/*

This will fix the message. As soon as you install some new gem and you have this message - just run the script again.

Next it came the problem with SQLIte3:

Building native extensions.  This could take a while...
ERROR:  Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.8 extconf.rb
checking for sqlite3.h... no
sqlite3.h is missing. Try 'port install sqlite3 +universal'
or 'yum install sqlite3-devel' and check your shared library search path (the
location where your sqlite3 shared library is located).
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

This is solved by installing the development package of SQLite Ruby:

sudo apt-get install libsqlite3-dev

And at the end it came the problem with missing ExecJS engine:

``

This I solved by downloading JavaScript engine from the URL mentioned (in my case Google V8) and putting on require in config/boot.rb

sudo gem install execjs
sudo gem install therubyracer

And adjust your applicaiton’s config/boot.rb:

require 'rubygems'
require 'execjs'
require 'v8'


# Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)

require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])

After all these fixes, everything ran smooth.

I am sure there could be more elegant way to fix all these issues, so feel free to propose solutions.

~Enjoy