简体   繁体   English

捆绑安装正在尝试安装不包含的gem?

[英]Bundle install is trying to install gems not included?

For some reason when i enter 由于某些原因,当我进入

$ bundle install 

it outputs this (Nokogiri is not in this gemfile). 它输出此内容(Nokogiri不在此gemfile中)。 I am new to mac so it could be something to do with rvm. 我是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.

I even tried following the directions on the nokogiri website (even though it wasn't in this gemfile) but it still didn't work. 我什至尝试按照nokogiri网站上的指示进行操作(即使它不在此gemfile中),但仍然无法正常工作。 I also even tried commenting out nokogiri in a different gemfile to see if that was the problem but still no success. 我什至还尝试在其他gemfile中注释掉nokogiri,以查看是否是问题所在,但仍然没有成功。

UPDATE For somereason now in this directory it is giving me, "Rails is not installed on this computer" however if i cd out of this directory and type rails -v it works fine. 更新对于此目录中的某些原因,它给了我“此计算机上未安装滑轨”的信息,但是如果我从该目录CD出并键入rails -v,它就可以正常工作。

There are dependency gems which you don't include in the gemfile, several gems use dependency gems for their operation, eg devise gem, you only include this gem into your gem file but it has dependency gems which get installed along with devise gem, you can check dependency gems in your Gemfile.lock file, here's the example for devise gem 还有,你不要在Gemfile中包括一些宝石使用依赖宝石为自己的操作,如依赖宝石devise的宝石,你只包括这种宝石到你的宝石文件,但它具有与得到一起安装的依赖宝石devise的宝石,你可以检查Gemfile.lock文件中的依赖项gem,这是devise gem的示例

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 and other gems are dependency gems here bcrypt-ruby和其他gem是依赖gem

First of all, bundler also (always) installs any requirements of all gems you want to install. 首先,捆绑程序还(总是)安装您要安装的所有gem的所有要求。 To see which gem requires nokogiri, take a look at Gemfile.lock , as this gives a complete list of all installed gems, versions and their requirements (including versions) 要查看哪个宝石需要nokogiri,请查看Gemfile.lock ,因为它提供了所有已安装宝石,版本及其要求(包括版本)的完整列表。

To solve your problem, you should install libiconv as stated in the error message. 要解决您的问题,您应该按照错误消息中的说明安装libiconv

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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