操作系统:AMI 2018.03.0(HVM)
Ruby版本:2.3.7p456 (2018-03-28 revision 63024) [x86_64-linux-gnu]
-使用yum install ruby23
gem安装nokogiri引发:
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.
current directory: /home/ec2-user/.gem/ruby/2.3/gems/nokogiri-
1.8.4/ext/nokogiri
/usr/bin/ruby2.3 -r ./siteconf20180801-6218-101te4s.rb extconf.rb
mkmf.rb can't find header files for ruby at
/usr/share/ruby/include/ruby.h
extconf failed, exit code 1
Gem files will remain installed in /home/ec2-
user/.gem/ruby/2.3/gems/nokogiri-1.8.4 for inspection.
Results logged to /home/ec2-user/.gem/ruby/2.3/extensions/x86_64-
linux/2.3/nokogiri-1.8.4/gem_make.out
我在这里想念什么?
答案 0 :(得分:2)
从错误输出中,似乎找不到Nokogiri试图使用Ruby进行开发的依赖关系,以原生地构建gem。
您可以运行yum -y install gcc ruby-devel rubygems
以确保已安装依赖项。
根据https://stackoverflow.com/a/4502672/1129980
现在在新的EC2实例上对此进行了测试:
yum install -y ruby23-devel gcc libxml2 libxml2-devel libxslt libxslt-devel patch
gem install nokogiri --no-ri --no-rdoc
可行:)
答案 1 :(得分:0)
尝试运行以下提到的命令
sudo yum -y install ruby-dev ( or ruby-devel)
sudo yum -y install libgmp-dev libgmpxx4ldbl ruby-dev ruby2.3-dev