简体   繁体   中英

Why did I get “LoadError: cannot load such file — nokogiri”?

I am trying to deploy my Ruby on Rails application onto the DigitalOcean server, but I got

LoadError: cannot load such file -- nokogiri

when I ran

cap production deploy:initial

from my local machine. I never required Nokogiri in my Gemfile or installed it for my application.

This is the error:

在此处输入图片说明

This is my gemfile:

source 'https://rubygems.org'

ruby "2.0.0"

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.3'
# Use sqlite3 as the database for Active Record
#gem 'sqlite3'

# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc


group :development, :test do

  gem 'mysql2', '~> 0.3.13'
  gem 'byebug'
  gem 'web-console', '~> 2.0'
  gem "rails-erd"

  gem 'capistrano',           require: false
  gem 'capistrano-rvm',       require: false
  gem 'capistrano-rails',     require: false
  gem 'capistrano-bundler',   require: false
  #gem 'capistrano-passenger', require: false
  gem 'capistrano3-puma',     require: false

end

group :production do

  gem 'rails_12factor', '0.0.2'
  gem 'thin'
  gem 'puma'

end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

#bootstrap
gem 'bootstrap-sass', '~> 3.3.4.1'

gem "better_errors"

#for user authentication 
gem "devise"

gem 'rails_admin', '~> 0.6.8'

gem 'jquery-ui-rails'

Nokogiri is a dependency of one of the gems you're using.

The most common cause for your problem is using different OSes in development and in production, such as developing in Windows and deploying to Linux.

The simplest, but not the best, fix is to edit your Gemfile.lock and remove all -x86-mingw32 references from the gem versions. For instance, replace

nokogiri (1.6.6.2-x86-mingw32)

with

nokogiri (1.6.6.2)

Nokogiri will not be the only gem version you'll have to edit manually, so search for other gems with -x86-mingw32 in their versions. There will also be at least pg . It does not cause an error during deploy, it simply does not install if your Gemfile.lock was generated on Windows.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM