I've successfully deployed a Rails 4 app via Capistrano from a MS Windows 7 machine to an Ubuntu 13.04 server setup with Nginx and passenger. However, I've come across this error (rather long) on page load (error below).
Has anyone else come across this error and know how to resolve it? My localhost works great in both development and production. I've Google and found that the cannot load such file -- nokogiri (LoadError)
happens for different reasons but with no clear resolution.
Note: the bottom half of the error file needed to be chopped due to character limit.
Gem file:
source 'https://rubygems.org'
ruby '2.0.0'
gem 'rails', '4.0.0'
gem 'rake', '10.1.0'
gem 'sqlite3', '1.3.8'
gem 'sass-rails', '~> 4.0.0'
gem "actionpack", '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'modernizr', '~> 2.6.2'
gem 'therubyracer', platforms: :ruby
gem 'jquery-rails', '3.0.4'
gem 'turbolinks', '1.3.0'
gem 'jbuilder', '~> 1.2'
gem 'nokogiri'
#Spree
gem 'spree', github: 'spree/spree'
gem 'spree_auth_devise', github: 'spree/spree_auth_devise'
gem 'ransack', github: 'ernie/ransack'
gem 'awesome_nested_set', github: 'collectiveidea/awesome_nested_set'
# Spree Payment Methods
gem 'spree_gateway', github: 'spree/spree_gateway'
# Spree Shipping Methods
gem 'spree_active_shipping', :git => "git://github.com/spree/spree_active_shipping"
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
gem 'debugger', group: [:development, :test]
group :production, :staging do
gem 'capistrano', '2.15.5'
gem 'mysql2', '0.3.13'
end
Error on page load:
cannot load such file -- nokogiri (LoadError)
/home/deploy/clientsite_staging/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
/home/deploy/clientsite_staging/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
/home/deploy/clientsite_staging/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
/home/deploy/clientsite_staging/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
/home/deploy/clientsite_staging/shared/bundle/ruby/2.0.0/gems/deface-1.0.0.rc4/lib/deface/parser.rb:1:in `<top (required)>'
/home/deploy/clientsite_staging/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
/home/deploy/clientsite_staging/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
/home/deploy/clientsite_staging/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
/home/deploy/clientsite_staging/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
/home/deploy/clientsite_staging/shared/bundle/ruby/2.0.0/gems/deface-1.0.0.rc4/lib/deface.rb:8:in `<top (required)>'
/home/deploy/clientsite_staging/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
/home/deploy/clientsite_staging/shared/bundle/ruby/2.0.0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
....[a lot more error file]...
SOLVED!
It was because the gem #gem 'bcrypt-ruby', '~> 3.0.0'
was commented out. It gave another error when I uncommented that gem so I researched and found that replacing it with gem 'bcrypt-ruby', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt'
works thanks to https://stackoverflow.com/a/17406994/2758139. I am now able to deploy and see the page load.