Rails 4部署在Ubuntu 13上 - nokogiri(LoadError)

时间:2013-09-12 17:46:59

标签: ruby ubuntu nginx ruby-on-rails-4 passenger

我已经成功通过Capistrano从MS Windows 7计算机部署了Rails 4应用程序到使用Nginx和乘客的Ubuntu 13.04服务器设置。但是,我在页面加载时遇到了这个错误(相当长)(下面的错误)。

是否有其他人遇到此错误并知道如何解决此问题?我的localhost在开发和生产方面都很棒。我是Google,发现cannot load such file -- nokogiri (LoadError)因不同原因而发生,但没有明确的解决方案。

注意:由于字符限制,错误文件的下半部分需要被删除。

宝石文件:

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

页面加载时出错:

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]...

解决!

这是因为宝石#gem 'bcrypt-ruby', '~> 3.0.0'被注释掉了。当我取消注释该gem时,它给出了另一个错误,因此我研究并发现用gem 'bcrypt-ruby', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt'替换它可以使用https://stackoverflow.com/a/17406994/2758139。我现在能够部署并查看页面加载。

0 个答案:

没有答案