Open yudao opened 10 years ago
Maybe try setting explicit ruby version in Gemfile
source 'https://rubygems.org'
ruby '2.0'
http://stackoverflow.com/questions/19305801/gem-install-error-ruby-version-1-9-3-required
Are you using rvm? Posting your Gemfile might help as well.
Lastly you can downgrade nokogiri and see if that works:
$ gem install nokogiri -v 1.5.11
Then try bundle install
again and bundler should pick that one up and use it, since ruhoh has dependency on >= ~> 1.5
Thanks @plusjade
I have a problem with my Ruby installation because when I try to add ruby '2.0' the console respond:
$ bundle install
Your Ruby version is 1.8.7, but your Gemfile specified 2.0
And my ruby version is:
$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
I've installed ruby by Homebrew and if I try again:
$ brew install ruby
Warning: ruby-2.0.0-p353 already installed
On Mavericks here too. For what it's worth, I just experienced this:
$ which ruby
/usr/bin/ruby
$ ruby --version
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
$ which bundle
/Users/dmitry/.rvm/bin/bundle // I've got rvm installed...
$ bundle install
ERROR: RVM Ruby not used, run `rvm use 2.0.0` first.
$ rvm use 1.9.3
Using /Users/dmitry/.rvm/gems/ruby-1.9.3-p448
$ bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Installing directory_watcher (1.4.1)
Installing mini_portile (0.5.2)
Installing mustache (0.99.5)
Installing nokogiri (1.6.1)
Installing rack (1.5.2)
Installing redcarpet (2.3.0)
Installing ruhoh (2.6)
Using bundler (1.3.5)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
Now, I installed the bundle gem on the system config and repeated my attempt:
$ rvm use system
$ sudo gem install bundle
$ rm Gemfile.lock
$ sudo bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Installing directory_watcher (1.4.1)
Installing mini_portile (0.5.2)
Installing mustache (0.99.5)
Installing nokogiri (1.6.1)
Installing rack (1.5.2)
Using redcarpet (2.3.0)
Installing ruhoh (2.6)
Using bundler (1.5.2)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
Seems to have worked both ways? RVM sucks, but having to install everything into /Library/
with sudo
is even worse.
My results agree with @dminkovsky. Looks like it's a system-ruby specific issue?
$ rbenv version
2.1.0 (set by /usr/local/opt/rbenv/version)
$ mkdir ruhoh-test && cd ruhoh-test
~/Projects/ruhoh-test
$ echo "source 'https://rubygems.org'\n\ngem 'ruhoh'" >> Gemfile
$ bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Installing directory_watcher (1.4.1)
Installing mini_portile (0.5.2)
Installing mustache (0.99.5)
Installing nokogiri (1.6.1)
Installing rack (1.5.2)
Installing redcarpet (2.3.0)
Installing ruhoh (2.6)
Using bundler (1.5.1)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
Had the same issue--the following worked for me as well:
$ rvm use system
$ sudo gem install bundle
$ bundle
what about for those using rbenv ? I'm having nokogiri issues as well when bundling.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/garytsai/.rbenv/versions/2.2.1/bin/ruby -r ./siteconf20150314-10362-br021k.rb extconf.rb --with-iconv-dir=/usr/local/Cellar/libiconv/1.14/
Extracting libxml2-2.8.0.tar.gz into tmp/x86_64-apple-darwin14.1.0/ports/libxml2/2.8.0... OK
Running 'configure' for libxml2 2.8.0... OK
Running 'compile' for libxml2 2.8.0... OK
Running 'install' for libxml2 2.8.0... OK
Activating libxml2 2.8.0 (from /Users/garytsai/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.1/ports/x86_64-apple-darwin14.1.0/libxml2/2.8.0)...
Extracting libxslt-1.1.26.tar.gz into tmp/x86_64-apple-darwin14.1.0/ports/libxslt/1.1.26... OK
Running 'configure' for libxslt 1.1.26... ERROR, review '/Users/garytsai/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.1/ext/nokogiri/tmp/x86_64-apple-darwin14.1.0/ports/libxslt/1.1.26/configure.log' to see what happened.
*** 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/garytsai/.rbenv/versions/2.2.1/bin/$(RUBY_BASE_NAME)
/Users/garytsai/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:279:in `block in execute': Failed to complete configure task (RuntimeError)
from /Users/garytsai/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:271:in `chdir'
from /Users/garytsai/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:271:in `execute'
from /Users/garytsai/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:66:in `configure'
from /Users/garytsai/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:109:in `cook'
from extconf.rb:101:in `block in <main>'
from extconf.rb:131:in `call'
from extconf.rb:131:in `block in <main>'
from extconf.rb:122:in `tap'
from extconf.rb:122:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/garytsai/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.1 for inspection.
Results logged to /Users/garytsai/.rbenv/versions/2.2.1/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/nokogiri-1.6.1/gem_make.out
An error occurred while installing nokogiri (1.6.1), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.6.1'` succeeds before bundling.
Hey @gary1410 , I've had a very similar issue and have been trying to fix it for days. In the end what worked for me was installing full xcode, previously I had only the command line tools. After I had it installed doing gem install nokogiri -v '1.6.1'
did work just fine.
@gary1410 @marano,
I also had a similar issue on the current Yosemite Beta with up to date Xcode. In my case it occurred when running bundle install
as part of this tutorial. What solved it for me was running xcode-select --install
and installing Xcode tools through there.
The big hint was this error:
The file "/usr/include/iconv.h" is missing in your build environment, which means you haven't installed Xcode Command Line Tools properly.
@mikecamilleri my case wasn't iconv at all. The error happened when compiling libxslt. The first time because of ggrep missing. After I fixed that it was saying it couldn't create the Makefile.
For anyone who has arrived here with the same problem. I reinstalled OS X Yosemite a week ago and just tried to install Nokogiri again as part of the bundle install
in this tutorial. I am working in an rebind and encountered the same error. Even though I have Xcode installed, running xcode-select --install
fixed the issue.
Because this issue is still open, and in case it helps anyone, I'm going to mention that I just tried to install Nokogiri 1.6.6.2 on a fresh OS X El Capitan install with Xcode installed. Again, it failed with
The file "/usr/include/iconv.h" is missing in your build environment,
which means you haven't installed Xcode Command Line Tools properly.
until I ran xcode-select --install
.
I know this is an old issue, but I'm leaving this here in case it is useful to someone. Same problem; same solution on a clean install of MacOS Sierra. It seems there is something about the command line tools installed by the XCode GUI that the Nokogiri installation script doesn't like.
Darwin-D:mikecamilleri.github.io mike$ bundler install
Fetching gem metadata from https://rubygems.org/.........
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.9.0
Using thread_safe 0.3.5
Using addressable 2.4.0
Using coffee-script-source 1.10.0
Using execjs 2.7.0
Using colorator 0.1
Using ffi 1.9.14
Using multipart-post 2.0.0
Using gemoji 2.1.0
Using net-dns 0.8.0
Using public_suffix 1.5.3
Using sass 3.4.22
Using rb-fsevent 0.9.7
Using kramdown 1.11.1
Using liquid 3.0.6
Using mercenary 0.3.6
Using rouge 1.11.1
Using safe_yaml 1.0.4
Using jekyll-feed 0.5.1
Using mini_portile2 2.1.0
Using pkg-config 1.1.7
Using jekyll-paginate 1.1.0
Using jekyll-sitemap 0.10.0
Using terminal-table 1.6.0
Using bundler 1.14.3
Using tzinfo 1.2.2
Using coffee-script 2.4.1
Using ethon 0.9.0
Using rb-inotify 0.9.7
Using faraday 0.9.2
Using jekyll-sass-converter 1.3.0
Installing nokogiri 1.6.8 with native extensions
Using activesupport 4.2.7
Using jekyll-coffeescript 1.0.1
Using typhoeus 0.8.0
Using listen 3.0.6
Using sawyer 0.7.0
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/mike/.rbenv/versions/2.1.0/bin/ruby extconf.rb
Using pkg-config version 1.1.7
checking if the C compiler accepts ... yes
checking if the C compiler accepts
-Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
Using mini_portile version 2.1.0
checking for iconv.h... yes
checking for gzdopen() in -lz... yes
checking for iconv... yes
************************************************************************
IMPORTANT NOTICE:
Building Nokogiri with a packaged version of libxml2-2.9.4.
Team Nokogiri will keep on doing their best to provide security
updates in a timely manner, but if this is a concern for you and want
to use the system library instead; abort this installation process and
reinstall nokogiri as follows:
gem install nokogiri -- --use-system-libraries
[--with-xml2-config=/path/to/xml2-config]
[--with-xslt-config=/path/to/xslt-config]
If you are using Bundler, tell it to use the option:
bundle config build.nokogiri --use-system-libraries
bundle install
Note, however, that nokogiri is not fully compatible with arbitrary
versions of libxml2 provided by OS/package vendors.
************************************************************************
Extracting libxml2-2.9.4.tar.gz into
tmp/x86_64-apple-darwin16.4.0/ports/libxml2/2.9.4... OK
Running 'configure' for libxml2 2.9.4... OK
Running 'compile' for libxml2 2.9.4... ERROR, review
'/Users/mike/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.8/ext/nokogiri/tmp/x86_64-apple-darwin16.4.0/ports/libxml2/2.9.4/compile.log'
to see what happened. Last lines are:
========================================================================
unsigned short* in = (unsigned short*) inb;
^~~~~~~~~~~~~~~~~~~~~
encoding.c:815:27: warning: cast from 'unsigned char *' to 'unsigned short *'
increases required alignment from 1 to 2 [-Wcast-align]
unsigned short* out = (unsigned short*) outb;
^~~~~~~~~~~~~~~~~~~~~~
4 warnings generated.
CC error.lo
CC parserInternals.lo
CC parser.lo
CC tree.lo
CC hash.lo
CC list.lo
CC xmlIO.lo
xmlIO.c:1450:52: error: use of undeclared identifier 'LZMA_OK'
ret = (__libxml2_xzclose((xzFile) context) == LZMA_OK ) ? 0 : -1;
^
1 error generated.
make[2]: *** [xmlIO.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
========================================================================
*** 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/mike/.rbenv/versions/2.1.0/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
/Users/mike/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:366:in
`block in execute': Failed to complete compile task (RuntimeError)
from
/Users/mike/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:337:in
`chdir'
from
/Users/mike/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:337:in
`execute'
from
/Users/mike/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:111:in
`compile'
from
/Users/mike/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:150:in
`cook'
from extconf.rb:364:in `block (2 levels) in process_recipe'
from extconf.rb:257:in `block in chdir_for_build'
from extconf.rb:256:in `chdir'
from extconf.rb:256:in `chdir_for_build'
from extconf.rb:363:in `block in process_recipe'
from extconf.rb:262:in `tap'
from extconf.rb:262:in `process_recipe'
from extconf.rb:555:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in
/Users/mike/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.8 for
inspection.
Results logged to
/Users/mike/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/extensions/x86_64-darwin-16/2.1.0-static/nokogiri-1.6.8/gem_make.out
An error occurred while installing nokogiri (1.6.8), and Bundler cannot
continue.
Make sure that `gem install nokogiri -v '1.6.8'` succeeds before bundling.
Hi all,
I have an issue when I try bundle install:
So I tried:
My ruby version:
Thanks for your help.