gem install XXX报错

Posted 编程老高

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了gem install XXX报错相关的知识,希望对你有一定的参考价值。

问题:
    1、安装Ruby;
    2、安装rubygems:yum -y install rubygems
    3、通过gem安装bundle:gem install bundle

ERROR:  While executing gem ... (Gem::Exception)
    Unable to require openssl, install OpenSSL and rebuild ruby (preferred) or use non-HTTPS sources

方案:

[root@localhost ~]# yum -y install openssl-devel
...省略...
[root@localhost ~]# cd /opt/ruby-3.0.2/ext/openssl/
[root@localhost openssl]# ruby ./extconf.rb
checking for t_open() in -lnsl... no
checking for socket() in -lsocket... no
...省略...
creating extconf.h
creating Makefile
[root@localhost openssl]# vim /opt/ruby-3.0.2/ext/openssl/Makefile #在/opt/ruby-3.0.2/ext/openssl/Makefile文件顶部添加top_srcdir = ../..
[root@localhost openssl]# pwd
/opt/ruby-3.0.2/ext/openssl
[root@localhost openssl]# make install

以上是关于gem install XXX报错的主要内容,如果未能解决你的问题,请参考以下文章

gem install XXX报错

Gem install rmagick 报错问题~

gem install redis报错解决办法

gem install redis报错解决

gem install报错 ruby升级

安装cocoapod时,输入指令:sudo gem install cocopods 报错