0

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

有没有其他人遇到过这个错误并知道如何解决它?我的 localhost 在开发和生产中都表现出色。我在谷歌上发现这种情况的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#gem 'bcrypt-ruby', '~> 3.0.0'被注释掉了。gem 'bcrypt-ruby', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt'当我取消注释该 gem 时,它给出了另一个错误,因此我研究并发现由于https://stackoverflow.com/a/17406994/2758139将其替换为有效。我现在可以部署并查看页面加载。

4

0 回答 0