[英]I'm trying to install OpenGraph gem in ruby
I've searched entire web looking for a way to get over this error. 我搜索了整个网络,以寻找解决此错误的方法。 But it won't budge. 但这不会让步。 I installed all the libraries and dependencies according to my knowledge even uninstalled ruby and nokogiri and reinstalled again. 我根据自己的知识安装了所有库和依赖项,甚至卸载了ruby和nokogiri并再次重新安装。 But this error remains here. 但是此错误仍然存在。
Gem files will remain installed in /home/$User/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/nokogiri-1.4.7 for inspection. Results logged to /home/$User/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0-static/nokogiri-1.4.7/gem_make.out
This is from the gem_make.out log file from this location -> /.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0-static/nokogiri-1.4.7/gem_make.out 这来自以下位置的gem_make.out日志文件-> /.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0-static/nokogiri-1.4。 7 / gem_make.out
ERROR: Error installing opengraph: ERROR: Failed to build gem native extension. current directory: /home/$User/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/nokogiri-1.4.7/ext/nokogiri /home/$User/.rbenv/versions/2.4.2/bin/ruby -r ./siteconf20171125-15877-nibcps.rb extconf.rb --with-nokogiri-dir=/home/$User/.rbenv/versions/2.4.2/lib/ruby/gems/2.4.0/gems/ *** 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=/home/$User/.rbenv/versions/2.4.2/bin/$(RUBY_BASE_NAME) extconf.rb:10:in `<main>': uninitialized constant Config (NameError) Did you mean? RbConfig CONFIG extconf failed, exit code 1
PS: I'm not using opengraph_parser because it has a fallback method. PS:我不使用opengraph_parser,因为它具有后备方法。 I need opengraph gem because I need to catch the exception. 我需要opengraph gem,因为我需要捕获异常。
It's not opengraph, but rather nokogiri. 不是opengraph,而是nokogiri。
Nokogiri is a dependency for opengraph. Nokogiri是opengraph的依赖项。 https://rubygems.org/gems/opengraph/versions/0.0.4 https://rubygems.org/gems/opengraph/versions/0.0.4
So, it must be related on your machine not having the dependencies needed to support nokogiri (libxml2). 因此,它必须与没有支持nokogiri(libxml2)所需的依赖项的计算机上相关。
Install these dependencies on your machine (assuming your on Debian/Ubuntu ): 在您的机器上安装以下依赖项(假设您在Debian / Ubuntu上 ):
sudo apt-get install build-essential patch ruby-dev zlib1g-dev liblzma-dev
Fedora/Red Hat/CentOS: Fedora / Red Hat / CentOS:
sudo yum install -y gcc ruby-devel zlib-devel
sudo yum install -y rubygem-nokogiri (alternative)
Then try installing nokogiri by gem install nokogiri
然后尝试通过gem install nokogiri
For other variants, or OS: http://www.nokogiri.org/tutorials/installing_nokogiri.html 对于其他变体或操作系统: http : //www.nokogiri.org/tutorials/installing_nokogiri.html
For Fedora 26: Until further notice, install nokogiri version < 1.8 对于Fedora 26:除非另行通知,否则请安装<1.8的nokogiri版本
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.