我正在使用Rvm和ruby 2.1.5p273。
安装的nokogiri:
gem install nokogiri
安装完美:
Successfully installed nokogiri-1.6.5
Parsing documentation for nokogiri-1.6.5
Done installing documentation for nokogiri after 3 seconds
1 gem installed
输入后:
gem list | grep nokogiri
我得到:
nokogiri (1.6.5)
这一切都在Mac Yosemite上。
require 'nokogiri'
显示:LoadError: cannot load such file -- nokogiri/nokogiri
我在SO和其他论坛上搜索了几个小时没有解决方案正在运行。
gem env
给出:
RubyGems Environment:
- RUBYGEMS版本:2.4.5 - RUBY VERSION:2.1.5(2014-11-13 patchlevel 273)[x86_64-darwin14.0] - 安装目录:/Users/mac/.rvm/gems/ruby-2.1.5 - RUBY EXECUTABLE:/Users/mac/.rvm/rubies/ruby-2.1.5/bin/ruby - 可执行目录:/Users/mac/.rvm/gems/ruby-2.1.5/bin - SPEC CACHE目录:/Users/mac/.gem/specs - SYSTEM CONFIGURATION DIRECTORY:/ etc - RUBYGEMS PLATFORMS: - 红宝石 - x86_64-darwin-14 - 创业板路径: - /Users/mac/.rvm/gems/ruby-2.1.5 - /Users/mac/.rvm/gems/ruby-2.1.5@global - 创业板配置: - :update_sources =>真正 - :verbose =>真正 - :backtrace =>假 - :bulk_threshold => 1000 - 远程来源: - https://rubygems.org/ - 壳路径: - /Users/mac/.rvm/gems/ruby-2.1.5/bin - /Users/mac/.rvm/gems/ruby-2.1.5@global/bin - /Users/mac/.rvm/rubies/ruby-2.1.5/bin - / usr / local / heroku / bin - /Users/mac/.rbenv/shims - /Users/mac/.rbenv/bin - /Users/mac/.pyenv/bin - ./node_modules/.bin - / usr / local / bin - / usr / bin - / bin - / usr / sbin - / sbin - / usr / local / git / bin - /Users/mac/.gem/ruby/1.8/bin - / opt / nginx / sbin - /Users/mac/.bash_it/plugins/available/todo - /Users/mac/.rvm/bin - / Users / mac / android-sdks / platform-tools /
rvm info
给出
ruby-2.1.5:
系统: uname:" Darwin macs-MacBook-Pro.local 14.0.0 Darwin内核版本14.0.0:Fri Sep 19 00:26:44 PDT 2014; root:xnu-2782.1.97~2 / RELEASE_X86_64 x86_64" system:" osx / 10.10 / x86_64" bash:" / bin / bash => GNU bash,版本3.2.53(1)-release(x86_64-apple-darwin14)" zsh:" / usr / local / bin / zsh => zsh 5.0.5(x86_64-apple-darwin13.0.0)"
RVM: 版本:" rvm 1.26.4(最新)作者:Wayne E. Seguin,Michal Papis [https://rvm.io/]" 更新:" 1个月25天17个小时46分45秒前" 路径:" /Users/mac/.rvm"
红宝石: 翻译:" ruby" 版本:" 2.1.5p273" 日期:" 2014-11-13" 平台:" x86_64-darwin14.0" patchlevel:" 2014-11-13修订版48405" full_version:" ruby 2.1.5p273(2014-11-13修订版48405)[x86_64-darwin14.0]"
房屋: gem:" /Users/mac/.rvm/gems/ruby-2.1.5" ruby:" /Users/mac/.rvm/rubies/ruby-2.1.5"
二进制文件: ruby:" /Users/mac/.rvm/rubies/ruby-2.1.5/bin/ruby" irb:" /Users/mac/.rvm/rubies/ruby-2.1.5/bin/irb" gem:" /Users/mac/.rvm/rubies/ruby-2.1.5/bin/gem" rake:" /Users/mac/.rvm/gems/ruby-2.1.5/bin/rake"
环境: 路径:" /Users/mac/.rvm/gems/ruby-2.1.5/bin:/Users/mac/.rvm/gems/ruby-2.1.5@global/bin:/ Users / mac /。 RVM /红宝石/红宝石2.1.5 / bin中:在/ usr /本地/ Heroku的/ bin中:/Users/mac/.rbenv/shims:/Users/mac/.rbenv/bin:/Users/mac/.pyenv/bin :./ node_modules / .bin文件:在/ usr / local / bin目录:在/ usr / bin中:/ bin中:/ usr / sbin目录:/ sbin目录:在/ usr /本地/ git的/ bin中:/Users/mac/.gem/ruby/ 1.8 /箱中:/ opt / nginx的/ sbin目录:/Users/mac/.bash_it/plugins/available/todo:/Users/mac/.rvm/bin:/用户/ MAC / Android的软件开发工具包/平台工具/&# 34; GEM_HOME:" /Users/mac/.rvm/gems/ruby-2.1.5" GEM_PATH:" /Users/mac/.rvm/gems/ruby-2.1.5:/Users/mac/.rvm/gems/ruby-2.1.5@global" MY_RUBY_HOME:" /Users/mac/.rvm/rubies/ruby-2.1.5" IRBRC:" /Users/mac/.rvm/rubies/ruby-2.1.5/.irbrc" RUBYOPT:"" gemset:""
答案 0 :(得分:0)
你可以试试以下的东西:
brew update
xcode-select --install
brew install libiconv
brew link libiconv
然后试试这些:
gem pristine nokogiri
gem install nokogiri -- --with-iconv-dir=/usr/local/Cellar/libiconv/1.14
or
bundle install
另外,请检查您是否正确加载了正确的gemset / ruby版本。
答案 1 :(得分:-2)
我也有同样的问题,只是添加sudo
与我合作完全没问题
即你安装nokogiri的命令是:gem install nokogiri
现在尝试添加sudo,如下所示
sudo gem install nokogiri