其实当ruby安装成功后,然后在gem install --no-ri --no-rdoc rails的时候,报出了下面的错误:
01 |
Fetching: thread_safe-0.3.4.gem (100%) |
02 |
Successfully installed thread_safe-0.3.4 |
03 |
Fetching: minitest-5.5.1.gem (100%) |
04 |
Successfully installed minitest-5.5.1 |
05 |
Fetching: tzinfo-1.2.2.gem (100%) |
06 |
Successfully installed tzinfo-1.2.2 |
07 |
Fetching: i18n-0.7.0.gem (100%) |
08 |
Successfully installed i18n-0.7.0 |
09 |
Fetching: activesupport-4.2.0.gem (100%) |
10 |
Successfully installed activesupport-4.2.0 |
11 |
Fetching: rails-deprecated_sanitizer-1.0.3.gem (100%) |
12 |
Successfully installed rails-deprecated_sanitizer-1.0.3 |
13 |
Fetching: mini_portile-0.6.2.gem (100%) |
14 |
Successfully installed mini_portile-0.6.2 |
15 |
Fetching: nokogiri-1.6.6.2.gem (100%) |
16 |
Building native extensions. This could take a while... |
17 |
ERROR: Error installing rails: |
18 |
ERROR: Failed to build gem native extension. |
20 |
/usr/local/rbenv/versions/2.1.5/bin/ruby -r ./siteconf20150202-16570-18cdxm.rb extconf.rb |
21 |
checking if the C compiler accepts ... yes |
22 |
Building nokogiri using packaged libraries. |
23 |
checking for gzdopen() in -lz... yes |
24 |
checking for iconv... yes |
25 |
************************************************************************ |
28 |
Building Nokogiri with a packaged version of libxml2-2.9.2 |
29 |
with the following patches applied: |
30 |
- 0001-Revert-Missing-initialization-for-the-catalog-module.patch |
31 |
- 0002-Fix-missing-entities-after-CVE-2014-3660-fix.patch |
33 |
Team Nokogiri will keep on doing their best to provide security |
34 |
updates in a timely manner, but if this is a concern for you and want |
35 |
to use the system library instead; abort this installation process and |
36 |
reinstall nokogiri as follows: |
38 |
gem install nokogiri -- --use-system-libraries |
39 |
[--with-xml2-config=/path/to/xml2-config] |
40 |
[--with-xslt-config=/path/to/xslt-config] |
42 |
If you are using Bundler, tell it to use the option: |
44 |
bundle config build.nokogiri --use-system-libraries |
47 |
Note, however, that nokogiri is not fully compatible with arbitrary |
48 |
versions of libxml2 provided by OS/package vendors. |
49 |
************************************************************************ |
50 |
Extracting libxml2-2.9.2.tar.gz into tmp/x86_64-unknown-linux-gnu/ports/libxml2/2.9.2... OK |
51 |
Running patch with /usr/local/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.2/ports/patches/libxml2/0001-Revert-Missing-initialization-for-the-catalog-module.patch... |
52 |
Running 'patch' for libxml2 2.9.2... ERROR, review'/usr/local/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.2/ext/nokogiri/tmp/x86_64-unknown-linux-gnu/ports/libxml2/2.9.2/patch.log'to see what happened. |
53 |
*** extconf.rb failed *** |
54 |
Could not create Makefile due to some reason, probably lack of necessary |
55 |
libraries and/or headers. Check the mkmf.log file for more details. You may |
56 |
need configuration options. |
58 |
Provided configuration options: |
62 |
--without-opt-include=${opt-dir}/include |
64 |
--without-opt-lib=${opt-dir}/lib |
69 |
--ruby=/usr/local/rbenv/versions/2.1.5/bin/ruby |
72 |
--use-system-libraries |
78 |
--without-zlib-include=${zlib-dir}/include |
80 |
--without-zlib-lib=${zlib-dir}/lib |
83 |
/usr/local/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:279:in `block in execute': Failed to complete patch task (RuntimeError) |
84 |
from /usr/local/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:271:in `chdir' |
85 |
from /usr/local/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:271:in `execute' |
86 |
from extconf.rb:311:in `block in patch' |
87 |
from extconf.rb:308:in `each' |
88 |
from extconf.rb:308:in `patch' |
89 |
from /usr/local/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/mini_portile-0.6.2/lib/mini_portile.rb:108:in `cook' |
90 |
from extconf.rb:278:in `block in process_recipe' |
91 |
from extconf.rb:177:in `tap' |
92 |
from extconf.rb:177:in `process_recipe' |
93 |
from extconf.rb:475:in `<main>' |
95 |
extconf failed, exit code 1 |
97 |
Gem files will remain installed in/usr/local/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/nokogiri-1.6.6.2 forinspection. |
98 |
Results logged to /usr/local/rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/extensions/x86_64-linux/2.1.0-static/nokogiri-1.6.6.2/gem_make.out |
解决办法如下:
yum -y install libxml2 libxslt libxml2-devel libxslt-devel
gem install nokogiri -- --use-system-libraries
gem install rails
执行上面的步骤,就可以正常安装rails了.
(责任编辑:IT) |