【问题标题】:Nokogiri not installing as a gem even though it's listed in Gemfile即使 Nokogiri 在 Gemfile 中列出,它也没有作为 gem 安装
【发布时间】:2014-01-03 18:40:15
【问题描述】:

即使 Nokogiri 在 Gemfile 中列出,它也没有安装。帮忙?

[root@mongo p]# cat Gemfile
source 'http://rubygems.org'

gem 'rails', '3.2.12'
gem 'mysql2'
gem 'jquery-rails'


# ============================
# Gems
# ============================
gem 'whois'
gem 'nokogiri'
gem 'bson_ext'
gem 'bson'
gem 'newrelic_rpm'
gem 'rpm_contrib'
gem 'savon'


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails', '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'
  gem 'uglifier', '>= 1.0.3'
end


# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger (ruby-debug for Ruby 1.8.7+, ruby-debug19 for Ruby 1.9.2+)
# gem 'ruby-debug'
# gem 'ruby-debug19', :require => 'ruby-debug'

# Bundle the extra gems:
# gem 'bj'
# gem 'nokogiri'
# gem 'sqlite3-ruby', :require => 'sqlite3'
# gem 'aws-s3', :require => 'aws/s3'

# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
# group :development, :test do
#   gem 'webrat'
# end



[root@mongo p]# bundle install
Using rake (10.1.0)
Using i18n (0.6.4)
Using multi_json (1.7.7)
Using activesupport (3.2.12)
Using builder (3.0.4)
Using activemodel (3.2.12)
Using erubis (2.7.0)
Using journey (1.0.4)
Using rack (1.4.5)
Using rack-cache (1.2)
Using rack-test (0.6.2)
Using hike (1.2.3)
Using tilt (1.4.1)
Using sprockets (2.2.2)
Using actionpack (3.2.12)
Using mime-types (1.23)
Using polyglot (0.3.3)
Using treetop (1.4.14)
Using mail (2.4.4)
Using actionmailer (3.2.12)
Using arel (3.0.2)
Using tzinfo (0.3.37)
Using activerecord (3.2.12)
Using activeresource (3.2.12)
Using gyoku (1.0.0)
Using akami (1.2.0)
Using bson (1.9.0)
Using bson_ext (1.9.0)
Using coffee-script-source (1.6.2)
Using execjs (1.4.0)
Using coffee-script (2.2.0)
Using rack-ssl (1.3.3)
Using json (1.8.0)
Using rdoc (3.12.2)
Using thor (0.18.1)
Using railties (3.2.12)
Using coffee-rails (3.2.2)
Using httpi (2.0.2)
Using jquery-rails (3.0.1)
Using mysql2 (0.3.11)
Using newrelic_rpm (3.6.4.122)
Using nori (2.1.0)
Using bundler (1.3.1)
Using rails (3.2.12)
Using rpm_contrib (2.1.11)
Using sass (3.2.9)
Using sass-rails (3.2.6)
Using wasabi (3.1.0)
Using savon (2.2.0)
Using uglifier (2.1.1)
Using whois (3.1.3)
Your bundle is complete! It was installed into ./vendor/bundle

【问题讨论】:

  • 删除 Gemfile.lock 并重试
  • 请不要使用 root 帐户,使用rvm 将 gem 安装到 gemsets 中
  • 删除 Gemfile.lock 没有帮助...其他建议?谢谢!
  • bundler 重新创建了 Gemfle.lock,请验证,其中是否有 nokogiri gem?
  • 是的 gem 列在 Gemfile.lock 中

标签: ruby-on-rails rubygems gem bundler gemfile


【解决方案1】:

请首先删除 Gemfile.lock 文件以确保 bundle 重建所有依赖项,并像第一次一样安装所有 gem,然后重新创建文件,然后:

$ bundle install

请确认 nokogiri gem 已出现在 Gemfile.lock 中。然后确保正确安装了 nokogiri gem,输入:

$ bundle show nokogiri
/path/to/nokogiri/gem

我上面的命令向其他人显示错误找不到 gem 'nokogiri',这意味着您的系统设置不正确。所以请不要使用root账户,使用简单用户作为项目的持有者。为了将项目 gem 版本彼此分开,请使用 rvm 将 gems 安装到其 gemsets 中,因为它已编写为 here

【讨论】:

    猜你喜欢
    • 2011-12-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-01-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多