Search

Recent Posts

Tags


« | Main | »

Installing Rails 3.1 – sample_app_3_1

By Dale Reagan | December 2, 2011

Rails 3 Sample Application

This is simply one of those problems you may not see – especially if you have some sort of ‘standard OS build’ for a development server.

>> gem list rails
*** LOCAL GEMS ***
rails (3.0.1, 3.0.0)

>> which rails
/usr/local/rvm/gems/ruby-1.9.2-p290@rails3tutorial/bin/rails

>> gem install rails –version 3.1.0
Fetching: multi_json-1.0.3.gem (100%)
Fetching: activesupport-3.1.0.gem (100%)
Fetching: builder-3.0.0.gem (100%)
Fetching: i18n-0.6.0.gem (100%)
Fetching: bcrypt-ruby-3.0.1.gem (100%)
Building native extensions.  This could take a while…
Fetching: activemodel-3.1.0.gem (100%)

<snip – long list>

Successfully installed rack-ssl-1.3.2
Successfully installed railties-3.1.0
Successfully installed rails-3.1.0
23 gems installed
Installing ri documentation for multi_json-1.0.3…
Installing ri documentation for activesupport-3.1.0…
Installing ri documentation for builder-3.0.0…
unable to convert “\xF1” from ASCII-8BIT to UTF-8 for README, skipping
unable to convert “\xF1” from ASCII-8BIT to UTF-8 for README.rdoc, skipping
Installing ri documentation for i18n-0.6.0…
<snip – another long list>

Installing RDoc documentation for railties-3.1.0…
Installing RDoc documentation for rails-3.1.0…

>> gem list rails

*** LOCAL GEMS ***
rails (3.1.0, 3.0.1, 3.0.0)

Creating first Rails 3.1 Application

Fetching source index for http://rubygems.org/
Using rake (0.9.2.2)
<snip – long list..>
Installing gravatar_image_tag (1.0.0.pre2)
Using jquery-rails (1.0.18)
Installing nokogiri (1.5.0) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb
checking for libxml/parser.h… yes
checking for libxslt/xslt.h… no
—–
libxslt is missing.  please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
—–
*** 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.
<snip>
Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/nokogiri-1.5.0 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/nokogiri-1.5.0/ext/nokogiri/gem_make.out
An error occured while installing nokogiri (1.5.0), and Bundler cannot continue.                                                 
Make sure that `gem install nokogiri -v ‘1.5.0’` succeeds before bundling.

Ok, a ‘simple’ problem to resolve – the missing file ‘libxslt/xslt.h’ is the type of file usually included with ‘system development packages’.  This appears to be a ‘system level dependency’ – not directly a Rails ‘gem’ issue.  Also, Nokogiri must be a dependency from one of the gems I added since I did not explicitly add it…

Notes

I did not have a clue what nokogiri does (it’s an HTML, XML, SAX, & Reader parser)- but it was included when I made changes to the Gemfile (since I am following a tutorial.)  From the Nokogiri Web site many fixes are suggested (Hmm, another, ‘common’ problem with Rails development – but this one has help/solutions presented to you!)  If you are working on a  ‘traditional development’ server then the first ‘yum’ line below is all that may be needed but the second one is from the Nokogiri web page.

  1. sudo yum install -y libxml2 libxml2-devel libxslt libxslt-devel sqlite.dev
  2. sudo yum install -y gcc ruby-devel libxml2 libxml2-devel libxslt libxslt-devel

The next errror: ‘permission denied’…  (I had tried installing the gem via the Root Account – that failed and left files in the RVM tree which are owned by ‘root’.)  To resolve I simply moved the folder (since it is all under the RVM tree the first ‘user’ to create something ‘owns’ it – but anyone can rename the folder in the communal space… Of course, the PRB folder should be removed.)

mv /usr/local/rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/nokogiri-1.5.0  \

     /usr/local/rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/nokogiri-1.5.0.PRB

Now the ‘bundle install’ completes.


In the book Ruby on Rails Tutorial: Learn Rails by Example Michael Hartl he writes: “Also beware that lots of little things can go wrong….”, and a few sentences later on the same page, “When things like this happen to you, it’s always frustrating, but at least you know that it happens to everyone…”  [ Note that I purchased both the book and video combo product and liked them enough to become an ‘affiliate’ so clicking the link above AND purchasing help support this site – off course you could also hit the donate button…:) ]  BTW – if you using the book/videos then you need to review the updates on the site – Chapter 13 covers Rails 3.1.


Topics: Computer Technology, ROR, Web Technologies | Comments Off on Installing Rails 3.1 – sample_app_3_1

Comments are closed.


________________________________________________
YOUR GeoIP Data | Ip: 73.21.121.1
Continent: NA | Country Code: US | Country Name: United States
Region: | State/Region Name: | City:
(US only) Area Code: 0 | Postal code/Zip:
Latitude: 38.000000 | Longitude: -97.000000
Note - if using a mobile device your physical location may NOT be accurate...
________________________________________________

Georgia-USA.Com - Web Hosting for Business
____________________________________