我尝试bundle install --gemfile=Gemfile,但错误发生为:
安装 nokogiri (1.7.2) 时出错,Bundler 无法继续。
gem install nokogiri -v '1.7.2' --source 'http://rubygems.org/'在捆绑之前确保成功。
所以我尝试安装 nokogiri,然后拒绝:
错误:安装 nokogiri 时出错:
错误:无法构建 gem 原生扩展。
似乎nokogiri被锁定了。我想知道如何安装 nokogiri 的特定版本(1.7.2)。
我的操作系统是 Amazon Linux AMI 版本 2017.09,我已经安装了
mysql-devel sqlite-devel libcurl-devel ruby24 ruby24-devel zlib-devel gcc libxslt-devel libxml2-devel gcc-c++ make curl
Ruby 版本是 2.4,捆绑器版本是 1.17.3。详细的错误信息是:
current directory: /usr/local/share/ruby/gems/2.4/gems/nokogiri-1.7.2/ext/nokogiri
/usr/bin/ruby2.4 -r ./siteconf20190305-30890-gjsryi.rb extconf.rb
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
Using mini_portile version 2.1.0
checking for gzdopen() in -lz... yes
checking for iconv... yes
************************************************************************
IMPORTANT NOTICE:
Building Nokogiri with a packaged version of libxml2-2.9.4
with the following patches applied:
- 0001-Fix-comparison-with-root-node-in-xmlXPathCmpNodes.patch
- 0002-Fix-XPointer-paths-beginning-with-range-to.patch
- 0003-Disallow-namespace-nodes-in-XPointer-ranges.patch
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.