简体   繁体   中英

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). I am new to mac so it could be something to do with 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. I also even tried commenting out nokogiri in a different gemfile to see if that was the problem but still no success.

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.

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

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

First of all, bundler also (always) installs any requirements of all gems you want to install. 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)

To solve your problem, you should install libiconv as stated in the error message.

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