出于某种原因,当我进入
$ bundle install
它输出这个(Nokogiri不在这个gemfile中)。我是mac的新手,所以它可能与rvm有关。
Fetching gem metadata from https://rubygems.org/.........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using rake 10.3.2
Using i18n 0.6.9
Using minitest 4.7.5
Using multi_json 1.10.1
Using thread_safe 0.3.3
Using tzinfo 0.3.39
Using activesupport 4.0.5
Using builder 3.1.4
Using erubis 2.7.0
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.0.5
Using mime-types 1.25.1
Using polyglot 0.3.4
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 4.0.5
Using activemodel 4.0.5
Using activerecord-deprecated_finders 1.0.3
Using arel 4.0.2
Using activerecord 4.0.5
Using bundler 1.6.2
Using mini_portile 0.6.0
Building nokogiri using packaged libraries.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/Harry/.rvm/rubies/ruby-2.0.0-p481/bin/ruby extconf.rb
Building nokogiri using packaged libraries.
-----
libiconv is missing. please visit http://nokogiri.org/tutorials/installing_nokogiri.html for help with installing dependencies.
-----
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/Users/Harry/.rvm/rubies/ruby-2.0.0-p481/bin/ruby
--help
--clean
--use-system-libraries
--enable-static
--disable-static
--with-zlib-dir
--without-zlib-dir
--with-zlib-include
--without-zlib-include=${zlib-dir}/include
--with-zlib-lib
--without-zlib-lib=${zlib-dir}/lib
--enable-cross-build
--disable-cross-build
extconf failed, exit code 1
Gem files will remain installed in /Users/Harry/.rvm/gems/ruby-2.0.0-p481/gems/nokogiri-1.6.2.1 for inspection.
Results logged to /Users/Harry/.rvm/gems/ruby-2.0.0-p481/extensions/x86_64-darwin-13/2.0.0-static/nokogiri-1.6.2.1/gem_make.out
An error occurred while installing nokogiri (1.6.2.1), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.6.2.1'` succeeds before bundling.
我甚至尝试按照nokogiri网站上的说明进行操作(即使它不在这个宝石文件中),但它仍然无法正常工作。我甚至尝试在不同的gemfile中评论出nokogiri,看看是不是问题但仍然没有成功。
更新 对于某些原因,现在在这个目录中它给了我," Rails没有安装在这台计算机上"但是,如果我从这个目录中删除并键入rails -v它可以正常工作。
答案 0 :(得分:0)
在gem文件中没有包含依赖性gem,有些gem使用依赖性gem来进行操作,例如: devise
gem,你只将这个gem包含在你的gem文件中,但它有依赖宝石,它与devise
gem一起安装,你可以检查Gemfile.lock
文件中的依赖宝石,这里是一个例子devise
宝石
devise (3.2.0)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5)
thread_safe (~> 0.1)
warden (~> 1.2.3)
bcrypt-ruby
和其他宝石在这里是依赖宝石
答案 1 :(得分:0)
首先,bundler也(总是)安装您要安装的所有gem的任何要求。要查看哪个gem需要nokogiri,请查看Gemfile.lock
,因为它提供了所有已安装的宝石,版本及其要求(包括版本)的完整列表
要解决您的问题,您应该按照错误消息中的说明安装libiconv
。